%% xycurve.tex from $Id: xycurve.doc,v 2.12 1994/10/25 03:01:14 ross Exp $
%%
%% XY-pic ``Curves and Splines'' extension.
%% Copyright (c) 1993-1994 Ross Moore <ross@mpce.mq.edu.au>
%%
%% This file is part of the XY-pic package for graphs and diagrams in TeX.
%% See the companion README and INSTALL files for further information.
%% Copyright (c) 1991-1994 Kristoffer H. Rose <kris@diku.dk>
%%
%% The XY-pic package is free software; you can redistribute it and/or modify
%% it under the terms of the GNU General Public License as published by the
%% Free Software Foundation; either version 2 of the License, or (at your
%% option) any later version.
%%
%% The XY-pic package is distributed in the hope that it will be useful, but
%% WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
%% or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
%% for more details.
%%
%% You should have received a copy of the GNU General Public License along
%% with this package; if not, write to the Free Software Foundation, Inc.,
%% 675 Mass Ave, Cambridge, MA 02139, USA.
%%
\ifx\xyloaded\undefined \input xy \fi
\xyprovide{curve}{Curve and Spline extension}{\stripRCS$Revision: 2.12 $}%
 {Ross Moore}{ross@mpce.mq.edu.au}%
 {Mathematics Department, Macquarie University, NSW~2109, Australia}
\message{curve,}
\xynew@{count}\crv@cnt@
\xydef@\xynumctrlpts@{\the\crv@cnt@}
\xynew@{toks}\crvpts@
\xydef@\setcurve@{%
 \edef\xysplineparams@{%
 \expandafter\noexpand\csname params@\endcsname}%
 \edef\xysplineedges@{%
 \expandafter\noexpand\csname edges@\endcsname}%
 \edef\xycrvcnt@{%
 \expandafter\noexpand\csname crvcnt@\endcsname}%
 \expandafter\edef\xycrvcnt@{\number\crv@cnt@}%
 \ifcase\crv@cnt@
 \expandafter\xycvxhull@\or
 \expandafter\xyquadbezier@\or
 \expandafter\xycubicbezier@\or
 \expandafter\xybspline@iii\or
 \expandafter\xybspline@iv\else
 \expandafter\xybspline@
 \fi}
\xydef@\curve{\connect\crv}
\xydef@\crv#1#{\hbox \bgroup \initshape@ \crv@{#1}}
\xydef@\crv@#1#2{%
 \DN@{#1}\ifx\empty\next@
 \DN@{\def\afterCURVEaction@{}\parsecurve@\xycurve@@}%
 \else\DN@{\parseCURVE@#1\parsecurve@\curveSTYLE@}\fi
 \next@ #2\@endcurve\endcrv@ }
\xydef@\curveSTYLE@{\xycurve@@}%
\xydef@\afterCURVEaction@{}%
\xydef@\@endcurve{}%
\xydef@\endcrv@@{\endcrv@\POS}%
\xywarnifdefined\crv@normaltemplate
\xywarnifdefined\crv@othertemplate
{\xyuncatcodes \catcode`\@=11 \catcode`\#=6
 \gdef\crv@normaltemplate#1{{}{~**#1\xy@@crvaddstack@}}
 \gdef\crv@othertemplate#1{{}{~*=<2\jot>{}~**#1\xy@@crvaddstack@}}
}
\xydef@\crvs#1#{\hbox \bgroup \DN@{\initshape@ \@crv@{#1}}%
 \ifx\bstartPLACE@\relax \else \ifx\bstartPLACE@\empty\else 
\splinetrace@{bstartPLACE@=\bstartPLACE@, bendPLACE@=\bendPLACE@}%
 \DN@{\let\xy@@crvaddstack@=\xy@@samecurve@
 \let\saveshape@=\savesame@ 
 \let\savectrlptsnum@=\relax
 \let\startxycurve@=\recovercurve@ 
 \crv@cnt@=\xycrvptsnum@\relax
 \@crv@{#1}}%
 \fi\fi \next@ }
\xydef@\xy@@samecurve@{\xyFN@\checkendcurve@}
\xydef@\savesame@{\egroup }
\xydef@\recovercurve@{\crv@cnt@=\xycrvptsnum@ \splinereset@
 \edef\cv@end{\cfromthec@}%
 \edef\cv@start{\cfromthep@}\splinereset@ }
\xydef@\@crv@#1#2{\DN@{#1#2}%
 \ifx\next@\empty \DN@{\crv@{}{\xy@@crvaddstack@}}%
 \else\def\tmp@{-}\ifx\next@\tmp@ \DN@{\crv@{}{\xy@@crvaddstack@}}%
 \else\def\tmp@{=}\ifx\next@\tmp@ 
 \DN@{\expandafter\crv@\crv@normaltemplate{\dir{=}}}%
 \else\def\tmp@{2-}\ifx\next@\tmp@ 
 \DN@{\expandafter\crv@\crv@normaltemplate{\dir{2.}}}%
 \else\def\tmp@{3-}\ifx\next@\tmp@ 
 \DN@{\expandafter\crv@\crv@normaltemplate{\dir{3.}}}%
 \else\def\tmp@{--}\ifx\next@\tmp@
 \DN@{\expandafter\crv@\crv@normaltemplate{\dir{--}}}%
 \else\def\tmp@{==}\ifx\next@\tmp@ 
 \DN@{\expandafter\crv@\crv@normaledtemplate{\dir2{--}}}%
 \else\def\tmp@{2--}\ifx\next@\tmp@ 
 \DN@{\expandafter\crv@\crv@normaledtemplate{\dir2{--}}}%
 \else\def\tmp@{3--}\ifx\next@\tmp@ 
 \DN@{\expandafter\crv@\crv@normaltemplate{\dir3{--}}}%
 \else\def\tmp@{.}\ifx\next@\tmp@
 \DN@{\expandafter\crv@\crv@normaltemplate{\dir{.}}}%
 \else\def\tmp@{..}\ifx\next@\tmp@
 \DN@{\expandafter\crv@\crv@normaltemplate{\dir{.}}}%
 \else
 \DN@{\expandafter\crv@\crv@othertemplate{\dir#1{#2}}}%
 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi \next@}
\xydef@\parseCURVE@{\def\curveSTYLE@{\xycurve@@}\def\afterCURVEaction@{}%
 \xyFN@\parseCURVE@@}
\xydef@\parseCURVE@@{%
 \ifx\space@\next\expandafter\DN@\space{\xyFN@\parseCURVE@@}%
 \else\ifx ~\next \DN@ ~{\xy@~{}\xyFN@\setcurveSTYLE@@}%
 \else\ifx\parsecurve@\next\DN@{}%
 \else\ifcat\active\noexpand\next\DN@{\xyactive@Warning}%
 \else\ifcat a\next\DN@##1{\xytilde@Warning\setcurveSTYLE@{##1}%
 \xyFN@\parseCURVE@@}%
 \else\DN@{}\fi\fi\fi\fi\fi \next@ }%
\xydef@\xyactive@Warning{\xywarning@{expandable control sequences should 
 not be here, results are unpredictable in diagrams.}}%
\xydef@\xytilde@Warning{Please use ~ to set curve style.}%
\xydef@\setcurveSTYLE@#1{\xyFN@\setcurveSTYLE@@#1}
\xydef@\setcurveSTYLE@@{%
 \ifx\next p\def\curveSTYLE@{\xyc@trlpts@@}%
 \DN@ p{\xyFN@\setafterCURVEaction@}%
 \else\ifx\next P\def\curveSTYLE@{\xyc@trlpts@}%
 \DN@ P{\xyFN@\setafterCURVEaction@}%
 \else\ifx\next l\def\curveSTYLE@{\xyc@vxhull@@}%
 \DN@ l{\xyFN@\setafterCURVEaction@}%
 \else\ifx\next L\def\curveSTYLE@{\xyc@vxhull@}%
 \DN@ L{\xyFN@\setafterCURVEaction@}%
 \else\ifx\next c\def\curveSTYLE@{\xycurve@@}%
 \DN@ c{\xyFN@\setafterCURVEaction@}%
 \else\ifx\next C\def\curveSTYLE@{\xycurve@@}%
 \DN@ C{\xyFN@\setafterCURVEaction@}%
 \else \DN@##1{\xywarning@{unknown curve style ##1}\xyFN@\parseCURVE@@}%
 \fi\fi\fi\fi\fi\fi \next@ }
\xydef@\setafterCURVEaction@{%
 \ifx\next~\DN@~{\xyFN@\setcurveSTYLE@@}%
 \else\ifcat a\next\DN@{\setafterCURVEaction@@}%
 \else\DN@{\xyFN@\parseCURVE@@}%
 \fi\fi \next@}
\xydef@\setafterCURVEaction@@{%
 \ifx\next c\DN@ c{%
 \def\afterCURVEaction@{\noexpand\endcurve\noexpand\xy@curve@}%
 \xyFN@\parseCURVE@@ }%
 \else\ifx\next C\DN@ C{%
 \def\afterCURVEaction@{\noexpand\endcurve\noexpand\xy@curve@@}%
 \xyFN@\parseCURVE@@ }%
 \else \DN@##1{\xywarning@{unknown after-curve action ##1}%
 \xyFN@\parseCURVE@@ }%
 \fi\fi \next@ }
\xydef@\parsecurve@{\xyFN@\parsecurve@@}
\xydef@\parsecurve@@{%
 \ifx\space@\next\expandafter\DN@\space{\xyFN@\parsecurve@@}%
 \else\ifx\next\@endcurve\DN@\@endcurve{\checkafterCURVE@}%
 \else\ifcat\active\noexpand\next\DN@{\relax}%
 \else\DN@{\xycurve@@}\fi\fi\fi\next@}%
\xydef@\xycurve@{\begingroup\afterCURVE{\setcurve@\endgroup}\crvobjects@
 \startxycurve@\xycrvmods@}
\xydef@\xycurve@@{\afterCURVE{\setcurve@}\crvobjects@\startxycurve@
 \xycrvmods@}
\xydef@\xy@curve@{\xy@curve@@@{\splinetolerance\z@\crvobjects@}}
\xydef@\xy@curve@@{\xy@curve@@@{\resetcrvobjects@}}
\xydef@\xy@curve@@@#1{\ifx\cv@start\relax
 \DN@{\xywarning@{There is no curve to plot}}.
 \else\DN@{\begingroup\afterCURVE{\setcurve@\endgroup}%
 #1\cv@end}\fi
 \next@ }
\xydef@\crvobjects@{\def\xycrvdrop@{}\def\xycrvconn@{}}
\xydef@\resetcrvobjects@{\crvobjects@}
\xylet@\savecurve=\xycurve@@
\xylet@\samecurve=\xy@curve@
\xydef@\xycrvmods@{\xyFN@\xy@crvmods@}%
\xydef@\xy@crvmods@{%
 \ifx\space@\next\expandafter\DN@\space{\xyFN@\xy@crvmods@}%
 \else\ifx\next ~\DN@ ~{\xyFN@\xy@crvmods@@}%
 \else\DN@{\xy@crvmods@@@@}\fi\fi \next@}%
\xydef@\xy@crvmods@@@@{\xyFN@\checkendcurve@}%
\xydef@\xy@crvmods@@{%
 \ifx\space@\next\expandafter\DN@\space{\xyFN@\xy@crvmods@@}%
 \else\ifx\next *\DN@ *{\xyFN@\xy@@crvmods@}%
 \else\addAT@\ifx\next\addAT@\DN@{\xyFN@\xy@@crvaddstack}%
 \else\DN@{\xywarning@{badly-formed curve option}\xyFN@\xy@crvmods@}%
 \fi\fi\fi \next@}%
\xydef@\xy@@crvmods@{%
 \ifx\space@\next\expandafter\DN@\space{\xyFN@\xy@@crvmods@}%
 \else\ifx\next *\DN@ *{\xyFN@\xy@@crvmods@@}%
 \else\DN@{\xy@crv@mods@@}\fi\fi \next@}%
\xydef@\xy@crv@mods@@#1#{\DN@##1{\xy@crvmods@@@{#1}{##1}}\next@}%
\xydef@\xy@crvmods@@@#1#2{%
 \DN@{#1#2}\ifx\next@\empty \def\xycrvdrop@{ #1{\zerodot}}%
 \else \def\xycrvdrop@{ #1{#2}}\fi
 \xyFN@\xy@crvmods@ }%
\xydef@\xy@@crvmods@@#1#{\DN@##1{\xy@@crvmods@@@{#1}{##1}}\next@}%
\xydef@\xy@@crvmods@@@#1#2{\def\xycrvconn@{ #1{#2}}\xyFN@\xy@crvmods@ }%
\xydef@\checkendcurve@{%
 \ifx\space@\next\expandafter\DN@\space{\xyFN@\checkendcurve@}%
 \else\ifx\next\endcurve\DN@\endcurve{\clearsearchflag@\endxycurve@}%
 \else\ifx\next\@endcurve\DN@\@endcurve{\checkafterCURVE@}%
 \else\ifx\next\xy@@crvaddstack@\DN@{}%
 \else\ifx\next\endxy\DN@{\clearsearchflag@\sloppyendcrv@}%
 \else\addAND@\ifx\next\addAND@\DN@{\clearsearchflag@\searchnextpt@}%
 \else\ifx ~\next\DN@ ~{\xyFN@\checkcrvtilde@}%
 \else\ifx\next\relax\DN@\relax{\clearsearchflag@\searchnextpt@}%
 \else\ifx\next\\\DN@\\{\clearsearchflag@\searchnextpt@}%
 \else\ifx\searchflag@\relax
 \DN@{\setsearchflag@\searchnextpt@}%
 \else\DN@##1{\flagwarn@{##1}}\fi
 \fi\fi\fi\fi\fi\fi\fi\fi\fi \next@ }
\xydef@\searchnextpt@{\afterPOS{\xy@@\addtocrv@ \xyFN@\checkendcurve@}}
\xydef@\checkafterCURVE@{%
 \edef\tmp@{\noexpand\xyFN@\noexpand\checkendcurve@
 \afterCURVEaction@\noexpand\endcurve}\tmp@ }
\xylet@\searchflag@=\relax
\xydef@\setsearchflag@{\let\searchflag@=@}
\xydef@\clearsearchflag@{\let\searchflag@=\relax}
\xydef@\flagwarn@#1{%
 \ifx\next\@endcurve\DN@{\xyFN@\checkendcurve@\endcurve}%
 \else\setsearchflag@\DN@{\xyFN@\checkendcurve@}%
 \xywarning@{skipping invalid token \string#1\space in curve}%
 \fi \next@ }
\xydef@\sloppyendcrv@{%
\xywarning@{Please use \string\endcurve\space to end the curve.}\endxycurve@}
\xydef@\endcrv@{\saveshape@
 \Edgec={\splineEdge}\Invisible@false\Hidden@false
 \edef\Drop@@{\noexpand\ifInvisible@ \setbox\z@=\copy\voidb@x
 \noexpand\else
 \noexpand\wdz@=\z@
 \noexpand\ht\z@=\z@ \noexpand\dp\z@=\z@
 \boxz@ \noexpand\fi }%
 \edef\Connect@@{%
 \noexpand\setbox\z@=\noexpand\box\lastobjectbox@
 \noexpand\wdz@=\z@
 \noexpand\ht\z@=\z@ \noexpand\dp\z@=\z@
 \noexpand\Drop@@
 \noexpand\ifHidden@\noexpand\else 
 \noexpand\ifx\noexpand\COORD@\noexpand\xymatrixCOORD@ \noexpand\else
 \noexpand\Xmin=\the\Xmin \noexpand\Xmax=\the\Xmax 
 \noexpand\Ymin=\the\Ymin \noexpand\Ymax=\the\Ymax
 \noexpand\fi \noexpand\fi
 \savecrvparams@ \noexpand\crvconnect@ }%
 \wdz@=\z@
 \ht\z@=\z@ \dp\z@=\z@ }
\xydef@\initshape@{\savescope@ 
 \ifdim\Xc>\Xp \Xmin=\Xp \Xmax=\Xc \else \Xmax=\Xp \Xmin=\Xc \fi
 \ifdim\Yc>\Yp \Ymin=\Yp \Ymax=\Yc \else \Ymax=\Yp \Ymin=\Yc \fi }
\xydef@\saveshape@{%
 \savectrlptsnum@ 
 \Rc=\Xmax \advance\Rc-\Xc \Lc=\Xc \advance\Lc-\Xmin
 \Uc=\Ymax \advance\Uc-\Yc \Dc=\Yc \advance\Dc-\Ymin
 \edef\tmp@{\egroup \Uc=\the\Uc \Dc=\the\Dc \Lc=\the\Lc \Rc=\the\Rc
 \noexpand\ifdim\noexpand\Xmin>\the\Xmin\noexpand\Xmin=\the\Xmin\noexpand\fi
 \noexpand\ifdim\noexpand\Ymin>\the\Ymin\noexpand\Ymin=\the\Ymin\noexpand\fi
 \noexpand\ifdim\noexpand\Xmax<\the\Xmax\noexpand\Xmax=\the\Xmax\noexpand\fi
 \noexpand\ifdim\noexpand\Ymax<\the\Ymax\noexpand\Ymax=\the\Ymax\noexpand\fi
 \savecrvparams@ 
 }\tmp@ \computeLeftUpness@ }
\xydef@\savecrvparams@{\crvpts@={\the\crvpts@}%
 \noexpand\def\noexpand\crvconnect@{\expandafter\noexpand\crvconnect@}}%
\xydef@\splineEdge{\rectangleEdge}
\xydef@\xy@@crvaddstack{%
 \ifx\next ~\xywarning@{there should be a poslist here, \string~@ ignored}%
 \DN@{\xy@crvmods@}%
 \else\DN@{\xy@@crvaddstack@}\fi \next@}
\xydef@\xy@@crvaddstack@{\smapxy@@\addtocrv@ \xyFN@\checkendcurve@}
\xydef@\checkcrvtilde@{%
 \addAT@\ifx\next\addAT@\DN@{\xy@@crvaddstack@}%
 \else\xywarning@{invalid token after ~, ignored}%
 \DN@##1{\xyFN@\checkendcurve@}%
 \fi \next@ }
\xydef@\crvconnect@@{%
 \def\Creset@@{\crvreset@}%
 \def\Cshavep@@{\crvshavep@}%
 \def\Cshavec@@{\crvshavec@}%
 \def\Cslidep@@{\crvslidep@}%
 \def\Cslidec@@{\crvslidec@}%
 \def\Calong@@{\crvalong@}%
}
\xydef@\straitconnect@{\crvconnect@@ 
 \let\Creset@@=\straitreset@
 \let\Cshavep@@=\straitshavep@
 \let\Cshavec@@=\straitshavec@
 \let\Cslidep@@=\straitslidep@
 \let\Cslidec@@=\straitslidec@
 \let\Calong@@=\straitalong@
}
\xydef@\straitreset@{\the\crvpts@ 
 \edef\xycrvptsnum@{\csname ptsnum@\endcsname}%
 \def\segmentnum@{0}}
\xydef@\straitslidep@{\setupDirection@ii \noCslidep@@ }
\xydef@\straitslidec@{\setupDirection@ii \noCslidec@@ }
\xydef@\straitshavep@{%
 \expandafter\ifnum\xycrvptsnum@>\z@
 \def\segmentnum@{0}%
 \csname cv@1\endcsname 
 \resetDirection@ \setupDirection@ii 
 \fi \noCshavep@@ }
\xydef@\straitshavec@{%
 \expandafter\ifnum\xycrvptsnum@>\z@
 \expandafter\count@@\xycrvptsnum@\relax 
 \bgroup \csname cv@\number\count@@\endcsname 
 \edef\tmp@{\egroup \Xp=\the\Xc \Yp=\the\Yc}\tmp@ 
 \edef\segmentnum@{\xycrvptsnum@}%
 \resetDirection@ \setupDirection@ii 
 \fi \noCshavec@@ }
\xydef@\straitalong@#1{%
 \ifdim#1\p@<\z@ 
 \xywarning@{parameter value #1 is negative, using 0}%
 \cfromp@ \def\PLACEf@{{0}}%
 \else 
 \dimen@=#1\p@ \count@=\dimen@ \divide\count@\p@ 
 \expandafter\count@@\xycrvptsnum@\relax \advance\count@@\@ne
 \advance\dimen@\segmentnum@\p@ 
 \advance\count@\segmentnum@\relax 
 \def\segmentnum@{0}%
 \ifnum\count@@<\count@
 \xywarning@{parameter value #1 too large, using \the\count@@}%
 \count@=\count@@ \advance\count@\m@ne \edef\PLACEf@{{1}}%
 \else
 \advance\dimen@-\count@\p@ 
 \ifdim\dimen@=\z@\ifnum\count@>\z@
 \advance\count@\m@ne \advance\dimen@\p@ \fi\fi
 \edef\PLACEf@{{\expandafter\removePT@\the\dimen@}}%
 \fi
 \ifnum\count@=\z@\else \bgroup
 \csname cv@\number\count@\endcsname 
 \edef\tmp@{\egroup \Xp=\the\Xc \Yp=\the\Yc}\tmp@
 \fi
 \advance\count@\@ne
 \ifnum\count@<\count@@
\splinetrace@{find place \the\dimen@\space along straight segment 
 \the\count@}%
 \csname cv@\number\count@\endcsname
 \fi
 \dX=\Xc \advance\dX-\Xp \dY=\Yc \advance\dY-\Yp 
 \fi \expandafter\noCalong@@\PLACEf@ \czeroEdge@ }
\xydef@\splineconnect@{%
 \let\crvreset@=\splinereset@
 \let\crvshavep@=\splineshavep@
 \let\crvshavec@=\splineshavec@
 \let\crvslidep@=\splineslidep@
 \let\crvslidec@=\splineslidec@
 \let\crvalong@=\splinealong@
}
\xydef@\splinereset@{\the\crvpts@ 
 \edef\xycrvptsnum@{\csname ptsnum@\endcsname}%
 \edef\xysplineparams@{%
 \expandafter\noexpand\csname params@\endcsname}%
 \edef\xysplineedges@{%
 \expandafter\noexpand\csname edges@\endcsname}%
 \def\segmentnum@{0}\def\splinecorrect@p{0}\def\splinecorrect@c{0}%
 \splinelength@=\z@ \def\splineplace@f{.5}%
}
\xydef@\splineshavep@{\begingroup 
 \edef\xysplineedges@{%
 \expandafter\noexpand\csname edges@\endcsname}%
 \expandafter\expandafter\expandafter\getsplineedges@\xysplineedges@
 \edef\tmp@{\noexpand\removePT@\the\dimen5}%
 \edef\tmp@{\endgroup 
 \noexpand\def\noexpand\splinecorrect@p{\tmp@}}\tmp@ 
 \setupDirection@ii }
\xydef@\splineshavec@{\begingroup 
 \edef\xysplineedges@{%
 \expandafter\noexpand\csname edges@\endcsname}%
 \expandafter\expandafter\expandafter\getsplineedges@\xysplineedges@
 \dimen@=-\dimen7\relax 
 \expandafter\count@\xycrvptsnum@\relax
 \ifnum\count@>\@ne \advance\count@\m@ne \fi
 \advance\dimen@\count@\p@
 \edef\tmp@{\noexpand\removePT@\the\dimen@}%
 \edef\tmp@{\endgroup 
 \noexpand\def\noexpand\splinecorrect@c{\tmp@}}\tmp@ 
 \setupDirection@ii }
\xydef@\splineslidep@#1{\enter@{\pfromthep@}%
 \begingroup \splinealong@@{0}{#1}+\splineslidep@@@
 \setupDirection@ii \leave@ }%
\xydef@\splineslidep@@@{%
 \dX=\dimen5 \dY=\dimen7 \edef\tmp@{\postfind@}\tmp@ \dimen@=\splineval@
 \expandafter\count@\xycrvptsnum@\relax
 \ifnum\count@>\tw@ \advance\count@\m@ne 
 \advance\dimen@\segmentnum@\p@ \advance\dimen@-\p@ 
 \fi 
 \edef\tmp@{\endgroup \endgroup
 \noexpand\def\noexpand\xysplineval@{\the\splineval@}%
 \noexpand\def\noexpand\splinecorrect@p{\expandafter\removePT@\the\dimen@}%
\splinetrace@{slide = \the\splinelength@}%
 \Xc=\dimen@i \Yc=\dimen3
 \dX=\the\dX \dY=\the\dY
 \noexpand\def\noexpand\segmentnum@{\segmentnum@}}\tmp@ }
\xydef@\splineslidec@#1{\enter@{\pfromthep@}%
 \begingroup
 \expandafter\splinealong@@\PLACEf@{#1}+\splineslidec@@@
 \setupDirection@ii \leave@ }
\xydef@\splineslidec@@@{%
 \dX=\dimen5 \dY=\dimen7 \edef\tmp@{\postfind@}\tmp@ \dimen@=\splineval@
 \expandafter\count@\xycrvptsnum@\relax
 \ifnum\count@>\tw@ \advance\count@\m@ne 
 \advance\dimen@\segmentnum@\p@ \advance\dimen@-\p@ 
 \dimen@=-\dimen@ \advance\dimen@\count@\p@
 \else \dimen@=-\dimen@ \advance\dimen@\p@ \fi
 \edef\tmp@{\endgroup \endgroup
 \noexpand\def\noexpand\xysplineval@{\the\splineval@}%
 \noexpand\def\noexpand\splinecorrect@c{\expandafter\removePT@\the\dimen@}%
\splinetrace@{slide = \the\splinelength@}%
 \Xc=\dimen@i \Yc=\dimen3
 \dX=\the\dX \dY=\the\dY
 \noexpand\def\noexpand\segmentnum@{\segmentnum@}}\tmp@ }
\xydef@\checkslidemore@#1{%
 \dimen@ii=-#1\relax\ifdim\dimen@ii<\z@\multiply\dimen@ii\m@ne\fi
 \dimen@=-\splinelength@ \advance\dimen@\dimen@ii\relax 
 \ifdim\dimen@<\z@\dimen@ii=-\dimen@\else\dimen@ii=\dimen@\fi
 \ifdim\dimen@ii<.2\p@\DN@{\splineslidec@@ \leave@}%
 \else \splinetrace@{not found yet, \the\dimen@ii\space still to go}%
 \dimen@ii=#1\relax\ifdim\dimen@ii<\z@\multiply\dimen@\m@ne\fi
 \DN@{\expandafter\splineslidemore@\expandafter{\the\dimen@}}\fi 
 \next@}%
\xydef@\splineslidemore@#1{%
 \expandafter\count@\segmentnum@\relax
 \ifdim#1<\z@\advance\count@\m@ne\dimen@=\p@
 \else\advance\count@\@ne\dimen@=\z@\fi
 \ifnum\count@<\@ne
 \expandafter\splinesegment@\expandafter{\segmentnum@}%
 \DN@{\xywarning@{cannot slide beyond start of curve}%
 \spline@find{\z@}{\z@}\splineslidec@@ \leave@ }%
 \else \expandafter\count@@\xycrvptsnum@\relax\advance\count@@\m@ne
 \expandafter\ifnum\count@@<\count@\relax
 \expandafter\splinesegment@\expandafter{\segmentnum@}%
 \DN@{\xywarning@{cannot slide beyond end of curve}%
 \spline@find{\p@}{\z@}\splineslidec@@ \leave@ }%
 \else
 \edef\segmentnum@{\the\count@}%
 \expandafter\splinesegment@\expandafter{\segmentnum@}%
\splinetrace@{sliding onto segment \segmentnum@}%
 \expandafter\spline@find\expandafter{\the\dimen@}{#1}%
 \DN@{\checkslidemore@{#1}}%
 \fi\fi \next@ }
\xydef@\splineslidec@@{%
 \dimen@=\splineval@ \advance\dimen@\segmentnum@\p@\advance\dimen@-\p@ 
 \edef\tmp@{\endgroup 
 \noexpand\def\noexpand\xysplineval@{\the\dimen@}%
\splinetrace@{slide = \the\splinelength@}%
 \Xc=\the\dimen@i \Yc=\the\dimen3 \dX=\the\dimen5 \dY=\the\dimen7 \postfind@ 
 \noexpand\def\noexpand\segmentnum@{\segmentnum@}}\tmp@
 \setupDirection@ii}
\xydef@\splinealong@#1{\def\postfind@{}\splinealong@@{#1}\z@+%
 \splineslidec@@}%
\xydef@\splinealong@@#1#2#3{%
 \edef\tmp@{#1}\relax \dimen@ii\tmp@\p@ 
 \expandafter\count@\xycrvptsnum@\relax
 \ifnum\count@>\@ne \advance\count@\m@ne \fi
 \dimen@=-\count@\p@ 
 \expandafter\advance\expandafter\dimen@\splinecorrect@p\dimen@ii
 \expandafter\advance\expandafter\dimen@\splinecorrect@c\dimen@ii
 \edef\tmp@{#1}\relax \dimen@=-\tmp@\dimen@ \relax
 \expandafter\advance\expandafter\dimen@\splinecorrect@p\p@
\splinetrace@{actual:\the\dimen@; f:\the\dimen@ii; p:\splinecorrect@p, c:\splinecorrect@c}%
 \count@=\dimen@ \divide\count@\p@ \DN@{\relax}%
 \def\tmp@{\relax}\ifx\next@\tmp@
 \expandafter\ifnum\xycrvptsnum@<\count@
 \xywarning@{parameter value #1 too large}\DN@{\relax}%
 \else
 \edef\xysplineval@{\the\dimen@}%
 \advance\dimen@-\count@\p@ 
 \ifdim\dimen@=\z@ 
\splinetrace@{find knot point \the\count@}%
 \ifnum\count@=\z@ \count@=\@ne \else \dimen@=\p@ \fi
 \else \advance\count@\@ne
\splinetrace@{find point \the\dimen@\space on spline segment \the\count@}%
 \fi 
 \edef\segmentnum@{\the\count@}%
 \edef\next@{\begingroup\noexpand\splinesegment@{\the\count@}}%
 \edef\nextii@{%
 \noexpand\spline@find{\the\dimen@}{#2}\noexpand\checksplinefind@{#2}}%
 \ifx-#3\relax \ifdim\dimen@>\z@\relax \ifdim\dimen@<\p@
 \dimen@=-\dimen@ \advance\dimen@\p@
 \edef\nextii@{\noexpand\splinereverse@
 \noexpand\spline@find{\the\dimen@}{#2}\noexpand\checksplinefind@{#2}}%
 \fi\fi\fi
 \fi\fi \expandafter\next@\nextii@ }
\xydef@\checksplinefind@#1{%
 \dimen@ii=#1\relax \dimen@=\splinelength@
 \ifdim\dimen@ii=\z@\DN@{}%
 \else
 \ifdim\dimen@ii<\z@\advance\dimen@\dimen@ii
 \else\advance\dimen@-\dimen@ii\fi
 \ifdim\dimen@<\z@\multiply\dimen@\m@ne\fi
 \ifdim\dimen@<.2\p@\DN@{}%
 \else
 \count@=\segmentnum@\relax 
 \ifdim\dimen@ii<\z@\advance\dimen@ii\splinelength@
 \ifnum\count@>\@ne\advance\count@\m@ne
 \edef\next@{\noexpand\splinesegment@{\the\count@}%
 \noexpand\spline@find\p@{\the\dimen@ii}%
 \noexpand\checksplinefind@{\the\dimen@ii}}%
 \else
 \xywarning@{cannot slide \the\dimen@ii\space before start}%
 \DN@{\splinesegment@\@ne \spline@find\z@\z@}\fi
 \else\advance\dimen@ii-\splinelength@
 \count@@=\numcontrolpts 
 \ifnum\count@<\count@@ \advance\count@\@ne
 \edef\next@{\noexpand\splinesegment@{\the\count@}%
 \noexpand\spline@find\z@{\the\dimen@ii}%
 \noexpand\checksplinefind@{\the\dimen@ii}}%
 \else
 \xywarning@{cannot slide \the\dimen@ii\space beyond end}%
 \DN@{\splinesegment@{\the\count@@}\spline@find\p@\z@}\fi
 \fi
 \fi\fi \next@ }
\xydef@\xyclearcrv@{\cv@end\cv@restore\loop@
 \expandafter\let\csname cv@\number\crv@cnt@\endcsname\relax
 \ifnum\crv@cnt@>0\advance\crv@cnt@\m@ne\repeat@
 \let\cv@start=\relax
 \let\cv@end=\relax \let\cv@restore=\relax
 \POS}
\xylet@\clearcurve=\xyclearcrv@
\xylet@\numcontrolpts=\xynumctrlpts@
\xydef@\xycontrolpt@#1{{%
 \ifnum#1<\z@\aftergroup\cv@restore\aftergroup\cv@start
 \else
 \expandafter\count@\xycrvptsnum@\relax \advance\count@\@ne
 \ifnum#1>\count@ \ifx\cv@end\relax 
 \expandafter\aftergroup\csname cv@\number#1\endcsname
 \else\aftergroup\cv@end\fi
 \else 
 \expandafter\ifx\csname cv@\number#1\endcsname\relax
 \ifnum#1=\z@\aftergroup\cv@start\else\aftergroup\cv@end\fi
 \else\expandafter\aftergroup\csname cv@\number#1\endcsname
 \fi\fi\fi}}%
\xylet@\xycontrolpt=\xycontrolpt@
\xydef@\startxycurve@{\crv@cnt@=\z@
 \edef\cv@start{\cfromthep@}%
 \ifdim\Rc=\z@\relax\ifdim\Lc=\z@\relax\ifdim\Dc=\z@\relax
 \ifdim\Uc=\z@\relax \Edgec={\zeroEdge}%
 \fi\fi\fi\fi 
 \edef\cv@end{\cfromthec@}%
 \edef\cv@restore{\pfromthep@\basefromthebase@}}
\xylet@\cv@start=\relax
\xylet@\cv@end=\relax
\xylet@\cv@restore=\relax
\xydef@\readxycurve@{\startxycurve@\xycrvmods@}
\xylet@\readxycurve=\readxycurve@
\xydef@\addtocrv@{\advance\crv@cnt@\@ne 
 \edef\tmp@{%
 \expandafter\noexpand\csname cv@\number\crv@cnt@\endcsname}%
 \expandafter\edef\tmp@{\cfromthec@}%
 \edef\tmp@{\noexpand\addtocrvpts@{\noexpand\def
 \expandafter\noexpand\tmp@{\Xc=\the\Xc \Yc=\the\Yc }}}\tmp@
 \edef\xycrvptsnum@{\the\crv@cnt@}%
}
\xydef@\xycrvdrop@{ {\zerodot}}
\xydef@\xycrvconn@{}
\xydef@\xyc@trlpts@{\def\xycrvdrop@{ \dir{x}}\def\xycrvconn@{}%
 \afterCURVE{\savecrvobjects@\xyctrlpts@}\readxycurve@}
\xydef@\xyc@trlpts@@{%
 \afterCURVE{\savecrvobjects@\def\xycrvdrop@{ \dir{x}}%
 \def\xycrvconn@{}\xyctrlpts@}\readxycurve@}
\xydef@\xyc@vxhull@{\def\xycrvdrop@{ {}}\def\xycrvconn@{ \dir{-}}%
 \afterCURVE{\savecrvobjects@\xycvxhull@}\readxycurve@}
\xydef@\xyc@vxhull@@{%
 \afterCURVE{\savecrvobjects@\def\xycrvdrop@{ {}}%
 \def\xycrvconn@{ \dir{-}}\xycvxhull@}\readxycurve@}
\xylet@\controlpts=\xyc@trlpts@
\xylet@\convexhull=\xyc@vxhull@
\xydef@\savecrvobjects@{\bgroup 
 \expandafter\toks@\expandafter{\xycrvdrop@}%
 \expandafter\toks@ii\expandafter{\xycrvconn@}%
 \edef\tmp@{\egroup\noexpand\def\noexpand\resetcrvobjects@{%
 \noexpand\def\noexpand\xycrvdrop@{\the\toks@}%
 \noexpand\def\noexpand\xycrvconn@{\the\toks@ii}%
 }}\tmp@}
\xydef@\afterCURVE#1{\def\afterCURVE@{#1}}
\xydef@\endxycurve@{\cv@end\savectrlptsnum@
 \expandafter\def\csname params@\endcsname{\the\crvpts@}%
 \cv@restore\afterCURVE@\POS}
\xylet@\endcurve=\endxycurve@
\xydef@\moretobedone#1{\xywarning@{\string#1 is not completed yet}} 
\xydef@\notyetdone#1{\xywarning@{\string#1 is not implemented yet}} 
\let\moretobedone=\eat@ \let\notyetdone=\eat@
\xydef@\xyctrlpts@{\cv@end \cv@restore
 \def\crvconnect@{\straitconnect@}%
 \ifnum\crv@cnt@>\z@ 
 \count@@@=\@ne \DN@{\loop@\xycontrolpt@{\count@@@}\relax
 \expandafter\xycvxhulldrop@\xycrvdrop@
 \ifnum\crv@cnt@>\count@@@\advance\count@@@\@ne\repeat@ 
 \cv@end \cv@restore }%
 \else\DN@{\relax}\fi \next@ }
\xylet@\xyctrlpts=\xyctrlpts@
\xydef@\addtocrvpts@#1{\crvpts@=\expandafter{\the\crvpts@#1}}
\xydef@\savescope@{\crvpts@={}%
 \edef\tmp@{\expandafter\noexpand\csname cv@0\endcsname}%
 \edef\tmp@{\noexpand\addtocrvpts@{\noexpand\def
 \expandafter\noexpand\tmp@{\Xc=\the\Xp \Yc=\the\Yp}}}\tmp@
}
\xydef@\savectrlptsnum@{%
 \advance\crv@cnt@\@ne 
 \edef\tmp@{%
 \expandafter\noexpand\csname cv@\number\crv@cnt@\endcsname}%
 \edef\tmp@{\noexpand\addtocrvpts@{\noexpand\def
 \expandafter\noexpand\tmp@{\Xc=\the\Xc \Yc=\the\Yc}}}\tmp@
 \advance\crv@cnt@\m@ne 
 \edef\tmp@{\expandafter\noexpand\csname ptsnum@\endcsname}%
 \edef\tmp@{\noexpand\addtocrvpts@{%
 \noexpand\def\expandafter\noexpand\tmp@{\number\crv@cnt@}}}\tmp@
}
\xydef@\xycvxhull@{\cv@end \cv@restore 
 \addtocrvpts@{\def\crvconnect@{\straitconnect@}}%
 \def\crvconnect@{\straitconnect@}%
 \ifnum\crv@cnt@>\z@ 
 \count@@@=\@ne\relax \DN@{\loop@\xycontrolpt@{\count@@@}\relax
 \expandafter\xycvxhulldrop@\xycrvdrop@
 {\expandafter\connect@\xycrvconn@\relax}\pfromc@
 \ifnum\crv@cnt@>\count@@@\relax \advance\count@@@\@ne\repeat@ 
 \cv@end }%
 \else
 \ifx\empty\xycrvconn@ \def\xycrvconn@{\dir{-}}\fi
 \DN@{\relax}\fi \next@ 
 {{\expandafter\connect@\xycrvconn@}}%
 \cv@end \cv@restore }
\xylet@\xycvxhull=\xycvxhull@
\xydef@\xycvxhulldrop@#1#{\drop@{#1}}
\xydef@\savespline@{%
 \edef\endspline@{\endgroup 
 \savesplineparams@ \savesplinerefs@
 \Xmin=\the\Xmin\relax \Xmax=\the\Xmax\relax
 \Ymin=\the\Ymin\relax \Ymax=\the\Ymax\relax
 \ifInvisible@\noexpand\Invisible@true
 \else\noexpand\Invisible@false\fi
 }\endspline@ 
 \edef\tmp@{\noexpand\addtocrvpts@{\savesplineparams@}}\tmp@
 \xycontrolpt@\z@ \cv@end
 }
\xydef@\savesplineparams@{%
 \noexpand\def\expandafter\noexpand\xysplineedges@{\xysplineedges@}}
\xydef@\savesplinerefs@{%
 \noexpand\def\noexpand\xysplineparams@{%
 \expandafter\noexpand\xysplineparams@}%
 \noexpand\def\noexpand\xysplineedges@{%
 \expandafter\noexpand\xysplineedges@}%
}
\xynew@{box}\splinebox@ 
\xynew@{dimen}\splineval@ 
\xynew@{dimen}\splinedepth@ 
\xynew@{dimen}\splinetol@ 
\xynew@{dimen}\splinelength@ 
\xynew@{if}\ifsplinefar@
\xynew@{if}\ifsplineplot@
\xydef@\splinetracing{\let\splinetrace@=\W@}
\xydef@\splineignore@#1{}
\xylet@\splinetrace@=\splineignore@
\xydef@\readsplineparams@{%
 \expandafter\expandafter\expandafter\getsplineparams@\xysplineparams@
 \expandafter\expandafter\expandafter\getsplineedges@\xysplineedges@}
\xydef@\getsplineedges@#1;#2,#3;#4,{%
 \global\dimen@i=#1\global\dimen5=#2\relax
 \dimen@=#3\multiply\dimen@\m@ne \advance\dimen@\splinelength@
 \global\dimen3=\dimen@
 \dimen@=#4\relax \count@=\dimen@ \divide\count@\p@
 \advance\dimen@-\count@\p@ \multiply\dimen@\m@ne
 \advance\dimen@ \count@\p@ \advance\dimen@\p@
 \global\dimen7=\dimen@ }
\xydef@\splinetolerance@#1{\dimen@=#1\relax
 \ifdim\dimen@>\z@\splinetol@=\dimen@
 \else\splinetol@=.4\p@\fi}
\xylet@\splinetolerance=\splinetolerance@
\splinetolerance@\z@
\xydef@\splinedefaulttol@{\splinetol@=.4\p@}
\xydef@\xylowtolerance@{\splinedefaulttol@
 \ifdim\splinetol@<\p@\divide\splinetol@\tw@\fi}
\xywarnifdefined\splinedrop@
\xydef@\setstdsplinedrop@{%
 \setbox\splinebox@=\hbox\bgroup
 \setboxz@h{\expandafter\object\xycrvdrop@{}}%
 \splinetolerance\z@ \dimen@=\wd\z@ \dimen@ii=\ht\z@ \advance\dimen@ii\dp\z@
 \ifdim\dimen@ii>\dimen@ \dimen@=\dimen@ii \fi \dimen@=1.4142\dimen@
 \ifdim\dimen@>\splinetol@ \splinetol@=\dimen@\else\dimen@=\splinetol@\fi
 \dimen@=.5\wd\z@ 
 \ht\z@=\z@ \dp\z@=\z@ \wd\z@=\z@ \kern-\dimen@ \Drop@@ \kern\dimen@
 \edef\tmp@{\egroup \splinetol@=\the\splinetol@
 \ifInvisible@\noexpand\Invisible@true
 \else\noexpand\Invisible@false\fi}\tmp@
 \edef\splinedefaulttol@{\splinetol@=\the\splinetol@}%
 \def\splinedrop@{\copy\splinebox@}%
}
\xywarnifdefined\splineconn@
\xydef@\stdsplineconn@{{\setsplinedir@
 \setboxz@h\bgroup\expandafter\object\xycrvconn@{}%
 \edef\tmp@{\egroup\Lc=\the\Lc \Rc=\the\Rc \Dc=\the\Dc \Uc=\the\Uc
 \noexpand\def\noexpand\Drop@@{\Drop@@}}\tmp@
 \setboxz@h{\kern-\Lc \boxz@}%
 \ht\z@=\z@ \dp\z@=\z@ \wd\z@=\z@ \Drop@@}}
\xydef@\setcrvobjects@{\setstdsplinedrop@ \def\splineconn@{\stdsplineconn@}}
\xydef@\splinenear@#1#2#3#4{{\dX=#1\advance\dX-#2%
 \ifdim\dX<\z@ \dX=-\dX\fi
 \ifdim\splinetol@<\dX \aftergroup\splinefar@true
 \else \dY=#3\advance\dY-#4\ifdim\dY<\z@ \dY=-\dY\fi
 \ifdim\splinetol@<\dY\aftergroup\splinefar@true
 \else \xydist@\dX\dY
 \ifdim\splinetol@<\dimen@ \aftergroup\splinefar@true
 \else 
 \ifdim\dimen@<.25\splinetol@\aftergroup\splinetooclose@\fi
 \fi\fi\fi}}
\xydef@\splineadvance@@{\global\advance\splineval@\splinedepth@}
\xydef@\splinetooclose@{\aftergroup\aftergroup\aftergroup\splinetooclose@@}
\xydef@\splinetooclose@@{\def\splineplotpt@{\relax}}
\xydef@\splinepoint{%
 {\splinetest@\ifsplineplot@\aftergroup\splinecontinue\fi}}
\xydef@\splinepoint@@{%
\splinetrace@{P@:(\the\Xc,\the\Yc)::\the\splineval@;\the\splinedepth@}%
 {\splinetest@\ifsplineplot@\relax\else\aftergroup\splinecontinue\fi}}
\xydef@\splinepoint@{%
 {\splinetest@\ifsplineplot@\aftergroup\splinecontinue\fi}}
\xydef@\splinecontinue@{\global\let\splinepoint=\splinepoint@@
 \global\let\splinecontinue=\splinecontinue@@}
\xydef@\splinecontinue@@{\global\let\splinepoint=\splinepoint@
 \global\let\splinecontinue=\relax}
\xylet@\splinecontinue=\splinecontinue@
\xydef@\splineknotpoint@{{\Xp=\Xc \Yp=\Yc \cv@start 
 \the\Edgec\@ne \ifInside@\else\aftergroup\splineknotpoint@@\fi}}%
\xydef@\splineknotpoint@@{{\Xp=\Xc \Yp=\Yc \cv@end 
 \the\Edgec\@ne \ifInside@\else \aftergroup\splinepoint\fi}}%
\xylet@\firstsplinepoint@=\splineknotpoint@
\xylet@\lastsplinepoint@= \splineknotpoint@
\xydef@\splined@@@{%
\splinetrace@{finding end types}%
 \def\splineStarttest{{\Xp=\Xc \Yp=\Yc \cv@start \the\Edgec\@ne 
 \ifInside@\aftergroup\splineplot@false\else\aftergroup\splineplot@true\fi}}%
 \def\splineEndtest{{\Xp=\Xc \Yp=\Yc \cv@end \the\Edgec\@ne 
 \ifInside@\aftergroup\splineplot@false\else\aftergroup\splineplot@true\fi}}%
 \DN@{\splinescan@}\ifx\bstartPLACE@\empty\else
 \ifx\bstartPLACE@\relax\else\ifx\bstartPLACE@\unknown@\else
 \DN@{\splinescanbreak@}%
 \DNii@{0}\ifx\bstartPLACE@\nextii@ \DNii@{1}\ifx\bendPLACE@\nextii@
 \DN@{}\fi\fi
 \fi\fi\fi \next@ }%
\xydef@\splinescan@{%
 \expandafter\def\xysplineedges@{\z@;\z@,\z@;\z@,}%
 \bgroup
\splinetrace@{scan for start}%
 \global\let\splineadvance@=\splineadvance@@
 \let\spline@start=\splinefindStart@
 \let\spline@end=\spline@end@@
 \let\splinefinish@=\splinefinish@@
 \let\splinewhich=\relax
 \global\splinelength@=\z@
 \let\splinerec@=\splineSrec@ 
 \edef\splineedges@{}%
 \expandafter\let\xysplineedges@\relax
 \bgroup \xylowtolerance@ \splined@@ \egroup
 \bgroup
\splinetrace@{scan for end}%
 \global\let\splineadvance@=\splineadvance@@
 \let\spline@start=\splinefindEnd@
 \let\spline@end=\spline@end@@ 
 \let\splinefinish@=\splinefinish@@
 \let\splinewhich=\relax
 \global\splinelength@=\z@ 
 \let\splinerec@=\splineErec@ 
 \xylowtolerance@ \splined@@ \egroup \egroup
 \expandafter\edef\xysplineedges@{\splineedges@}%
 \global\let\splineedges@=\relax
\splinetrace@{edge params: \xysplineedges@}}
\xydef@\splinescanbreak@{%
 \gdef\breakedges@{}%
 \DN@{0}\ifx\next@\bstartPLACE@
 \DN@{\bgroup \def\tmp@####1;####2,####3;####4,{%
 \global\splineval@=####2\relax}%
 \expandafter\expandafter\expandafter\tmp@\xysplineedges@
 \def\segmentnum@{\@ne}\splineRecordBreakValue \egroup}%
 \else
 \DN@{\bgroup \splinetrace@{scan for start}%
 \let\splinefbcontinue@=\breakstartcontinue@
 \let\splinef@pt=\splinef@breakpt
 \let\splinef@end=\break@start
 \edef\tmp@{{\bstartPLACE@}}%
 \expandafter\splinealong@@\tmp@\z@+\endgroup\egroup }%
 \fi \next@ 
 \DN@{1}\ifx\next@\bendPLACE@
 \DN@{\bgroup \def\tmp@####1;####2,####3;####4,{%
 \global\splineval@=####4\relax}%
 \expandafter\expandafter\expandafter\tmp@\xysplineedges@
 \def\segmentnum@{\@ne}\splineRecordBreakValue \egroup}%
 \else
 \DN@{\bgroup \splinetrace@{scan for end}%
 \let\splinefbcontinue@=\breakendcontinue@
 \let\splinef@pt=\splinef@breakpt
 \let\splinef@end=\break@end
 \edef\tmp@{{\bendPLACE@}}%
 \expandafter\splinealong@@\tmp@\z@-\endgroup\egroup }%
 \fi \next@ 
 \expandafter\def\expandafter
 \xybreakedges@\expandafter{\breakedges@}%
 \global\let\breakedges@=\relax
\splinetrace@{break params: \xybreakedges@::\bstartPLACE@--\bendPLACE@}%
 \expandafter\let\xysplineedges@\xybreakedges@ }
\xydef@\splineSrec@{{%
\splinetrace@{v=\the\splineval@ + d=\the\splinedepth@ :
 (\the\Xp,\the\Yp);(\the\Xc,\the\Yc):searching }%
 \splineStarttest
 \ifsplineplot@ 
 \ifdim\splinedepth@<.0001\p@ \aftergroup\splinefinish@
 \global\advance\splineval@ .5\splinedepth@
 \else\aftergroup\splinedecast@ \fi
 \else \aftergroup\splineadvance@ \fi}}
\xydef@\splinefindStart@@{\bgroup \bgroup 
 \expandafter\expandafter\expandafter\getsplineparams@\xysplineparams@
 \global\let\splineadvance@=\splineadvance@@
 \global\let\splinepoint=\relax
 \let\splinegoal@=\splineRecordValue \global\dimen5=\z@ 
 {\Xc=\Xp \Yc=\Yp \splinescanStarttest }%
} 
\xydef@\splinefindStart@{%
 \expandafter\crv@cnt@\xycrvptsnum@\relax
 \ifnum\crv@cnt@>\tw@
 \crv@cnt@=\@ne \splineplot@false \splinesegment@{\crv@cnt@}%
 {\splineStarttest
 \ifsplineplot@\aftergroup\splineplot@true\fi}%
 \ifsplineplot@ \else \searchforStartsegment@ \fi 
 \splinesegment@{\crv@cnt@}%
\splinetrace@{start is in segment \segmentnum@}%
 \else \splinesegment@\@ne \fi
 \splineplot@false \splinefindStart@@
}
\xydef@\searchforStartsegment@{\splineplot@true\loop@ 
 \advance\crv@cnt@\@ne 
 \expandafter\count@\xycrvptsnum@\relax
 \ifnum\count@=\crv@cnt@\expandafter\splineplot@false
 \else 
 \splinesegment@{\crv@cnt@}{\splineStarttest
 \ifsplineplot@\aftergroup\splineplot@false
 \else\aftergroup\splineplot@true\fi }%
 \fi \ifsplineplot@\repeat@ 
}
\xydef@\splinefindEnd@@{\bgroup \bgroup
 \expandafter\expandafter\expandafter\getsplineparams@\xysplineparams@
\splinetrace@{params:\xysplineparams@}%
 \splinereverse@@
\splinetrace@{params:\xysplineparams@}%
 \global\let\splineadvance@=\splineadvance@@
 \global\let\splinepoint=\splinescanEndtest 
 \let\splinegoal@=\splineRecordValue \global\dimen5=\z@ 
 {\Xc=\Xp \Yc=\Yp \splinescanEndtest }%
}
\xydef@\splinereverse@@{\splinereverse@@@}
\xydef@\splinereverse@@@{%
 \def\postspline@{\dX=-\dX \dY=-\dY}%
 \dimen@ii=\Xc \Xc=\Xp \Xp=\dimen@ii 
 \dimen@ii=\Yc \Yc=\Yp \Yp=\dimen@ii 
 \global\dimen5=-\dimen5\relax 
 \global\advance\dimen5\splinelength@ }
\xydef@\postspline@{}
\xydef@\splineErec@{{%
 \dimen@=\splineval@ \advance\dimen@\splinedepth@
\splinetrace@{ER (\the\Xp,\the\Yp);(\the\Xc,\the\Yc);;;
\the\dimen@,\the\splinedepth@}%
 \splineEndtest
 \ifsplineplot@ 
 \ifdim\splinedepth@<.0001\p@ \aftergroup\splinefinish@
 \else\aftergroup\splinedecast@ \fi
 \else \aftergroup\splineadvance@ \fi}}
\xydef@\splinefindEnd@{%
 \expandafter\crv@cnt@\xycrvptsnum@\relax 
 \ifnum\crv@cnt@>\tw@
 \advance\crv@cnt@\m@ne 
 \splineplot@false \splinesegment@{\crv@cnt@}%
 {\Xc=\Xp \Yc=\Yp \splineEndtest
 \ifsplineplot@\aftergroup\splineplot@true\fi }%
 \ifsplineplot@ 
 \else \searchforEndsegment@ \fi 
 \splinesegment@{\crv@cnt@}%
\splinetrace@{end is in segment: \segmentnum@ }%
 \else \splinesegment@\@ne \fi
 \splineplot@false\splinefindEnd@@
}
\xydef@\searchforEndsegment@{\splineplot@true\loop@ 
 \advance\crv@cnt@\m@ne 
 \ifnum\crv@cnt@=\z@\expandafter\splineplot@false
 \else 
 \splinesegment@{\crv@cnt@}{\Xc=\Xp \Yc=\Yp \splineEndtest
 \ifsplineplot@\aftergroup\splineplot@false
 \else\aftergroup\splineplot@true\fi}%
 \fi \ifsplineplot@\repeat@ 
}
\xydef@\splinescanStarttest{%
\splinetrace@{SST (\the\Xc,\the\Yc); \the\splinelength@, \the\splineval@}%
 {\splineplot@false\splineStarttest
 \ifsplineplot@\expandafter\splinefinish@\fi}}
\xydef@\splinescanEndtest{%
\splinetrace@{SET (\the\Xc,\the\Yc); \the\splinelength@, \the\splineval@}%
 {\splineplot@false\splineEndtest 
 \ifsplineplot@\expandafter\splinefinish@\fi}}
\xydef@\splineBrec@{{%
 \dimen@=\splineval@ \advance\dimen@\splinedepth@
\splinetrace@{BR (\the\Xp,\the\Yp);(\the\Xc,\the\Yc);;;
\the\dimen@,\the\splinedepth@}%
 \splineEndtest
 \ifsplineplot@ \aftergroup\splineadvance@ \else
 \ifdim\splinedepth@<.0001\p@ \aftergroup\splinefinish@
 \else\aftergroup\splinedecast@ \fi \fi}}
\xydef@\splinef@breakpt#1{%
 \ifdim\splineval@>\z@
\splinetrace@{found: val=\the\splineval@;(\the\Xc,\the\Yc)}%
 \else
\splinetrace@{found: val=\the\splineval@;(\the\Xp,\the\Yp)}%
 \fi \splinefbcontinue@ }
\xydef@\splinef@pt@@{%
 \ifdim\splineval@>\z@ 
\splinetrace@{found: val=\the\splineval@;c:(\the\Xc,\the\Yc)}%
 \global\dimen@i=\Xc \global\dimen3=\Yc 
 \else
\splinetrace@{found: val=\the\splineval@;p:(\the\Xp,\the\Yp)}%
 \fi
 \setsplinedir@ \global\dimen5=\dX \global\dimen7=\dY 
 \global\splineval@=\splineval@
 \aftergroup\splinefocus@ }
\xydef@\breakstartcontinue@{%
\splinetrace@{move to start edge, from (\the\Xc,\the\Yc): val=\the\splineval@ }%
 \global\let\splinetest@=\splineStarttest
 \global\let\splinerec@=\splineSrec@
 \global\let\splinepoint=\relax
 \global\let\spline@end=\checkfoundSbreak@ 
 \global\let\splinegoal@=\splineRecordBreakValue 
 \global\let\splinefinish@=\splinefinish@@ }
\xydef@\checkfoundSbreak@{%
 \ifnum\xycrvptsnum@<\thr@@\DN@{\egroup}%
 \else\DN@{\searchBreakSsegment@}\fi \next@ }%
\xydef@\searchBreakSsegment@{%
 \crv@cnt@=\segmentnum@ \DN@{}\count@=\crv@cnt@
 \DNii@{}\ifnum\splineval@=\z@ \ifnum\crv@cnt@=\@ne
 \ifnum\xycrvptsnum@=\@ne\count@=\z@\DNii@{\egroup}\fi
 \else\DN@{\egroup}\fi
 \else \advance\crv@cnt@\@ne \fi 
 \ifnum\count@=\xycrvptsnum@
 \DN@{\expandafter\splineRecordBreakValue\nextii@}\else
 \DN@{\splinesegment@{\crv@cnt@}\splined@@ \egroup}%
 \fi \next@ }
\xydef@\checkfoundEbreak@{%
 \ifnum\xycrvptsnum@<\thr@@\DN@{\egroup}%
 \else\DN@{\searchBreakEsegment@}\fi \next@ }%
\xydef@\searchBreakEsegment@{%
 \crv@cnt@=\segmentnum@ \DN@{}\count@=\crv@cnt@
 \DNii@{}\ifnum\splineval@=\z@ \ifnum\crv@cnt@=\@ne
 \ifnum\xycrvptsnum@=\@ne\count@=\z@\DNii@{\egroup}\fi
 \else\DN@{\egroup}\fi
 \else \advance\crv@cnt@\m@ne \fi 
 \ifnum\count@=\z@
 \DN@{\expandafter\splineRecordBreakValue\nextii@}\else
 \DN@{\splinesegment@{\crv@cnt@}\splinereverse@
 \readsplineparams@ \splined@@ \egroup}%
 \fi \next@ }
\xydef@\break@start{\egroup \egroup 
\splinetrace@{scan for start}%
 \global\let\splineadvance@=\splineadvance@@
 \let\spline@start=\splinefindBStart@
 \let\spline@end=\egroup
 \let\splinefinish@=\splinefinish@@
 \let\splinewhich=\relax
 \global\let\splineadvance@=\splineadvance@@
 \global\let\splinepoint=\relax
 \let\splinegoal@=\splineRecordBreakValue
 \global\dimen5=\z@ \global\splinelength@=\z@
 \let\splinerec@=\splineSrec@ 
 \def\breakedges@{}%
 \bgroup \bgroup \splined@@ }
\xydef@\splinefindBStart@{\bgroup \global\splineval@=\z@ }
\xydef@\breakendcontinue@{%
\splinetrace@{move to end edge, from (\the\Xc,\the\Yc): val=\the\splineval@ }%
 \global\let\splinetest@=\splineEndtest
 \global\let\splinerec@=\splineErec@
 \global\let\splinepoint=\relax
 \global\let\spline@end=\checkfoundEbreak@ 
 \global\let\splinegoal@=\splineRecordBreakValue 
 \global\let\splinefinish@=\splinefinish@@ }
\xydef@\break@end{\egroup \egroup
 \global\let\splineadvance@=\splineadvance@@
 \let\spline@start=\splinefindBEnd@
 \let\spline@end=\egroup 
 \let\splinefinish@=\splinefinish@@
 \let\splinewhich=\relax
 \global\let\splineadvance@=\splineadvance@@
 \global\let\splinegoal@=\splineRecordBreakValue
 \global\splinelength@=\z@ 
 \let\splinerec@=\splineErec@ 
 \bgroup \splined@@ }
\xydef@\splinefindBEnd@{\bgroup\bgroup 
 \splinereverse@ \readsplineparams@ 
 \global\splineval@=\z@ }
\xydef@\checkfoundbreak@{%
 \ifnum\xycrvptsnum@<\thr@@\DN@{\egroup}%
 \else\DN@{\searchforBreaksegment@}\fi \next@ }%
\xydef@\searchforBreaksegment@{%
 \crv@cnt@=\segmentnum@ \DN@{}\count@=\crv@cnt@
 \DNii@{}\ifnum\splineval@=\z@ \ifnum\crv@cnt@=\@ne
 \ifnum\xycrvptsnum@=\@ne\count@=\z@\DNii@{\egroup}\fi
 \else\DN@{\egroup}\fi
 \else \advance\crv@cnt@\@ne \fi 
 \ifnum\count@=\xycrvptsnum@
 \DN@{\expandafter\splineRecordBreakValue\nextii@}\else
 \DN@{\egroup}\ifx\next@\nextii@
 \DN@{\splinesegment@{\crv@cnt@}\splined@@ \egroup}%
 \else\DN@{\splinesegment@{\crv@cnt@}\splined@@ \egroup}%
 \fi\fi \next@ }
\xydef@\splineRecordValue{%
 \ifx\unknown\segmentnum@\relax
 \else\expandafter\advance\expandafter\splineval@\segmentnum@\p@
 \advance\splineval@-\p@ \fi
 \xdef\splineedges@{\splineedges@\the\splinelength@;\the\splineval@,}%
\splinetrace@{found edge: \splineedges@}}
\xydef@\splineRecordBreakValue{%
 \ifx\unknown\segmentnum@\relax
 \else\expandafter\advance\expandafter\splineval@\segmentnum@\p@
 \advance\splineval@-\p@ \fi
 \xdef\breakedges@{\breakedges@\the\splinelength@;\the\splineval@,}%
 \global\let\spline@end=\egroup
\splinetrace@{found break edge: \breakedges@}}
\xydef@\splineRecordBreakEValue{%
 \ifdim\splineval@>\z@
 \splineval@=-\splineval@ \advance\splineval@\p@ \fi
 \splineRecordBreakValue }%
\xydef@\xydist@#1#2{\ifdim#1>#2\relax
 \quotient@@\tmp@#2#1\expandafter\dimen@ii\tmp@#2\relax
 \ifdim\dimen@ii>.41422#1\relax
 \dimen@=1.060665#1\advance\dimen@ .353555\dimen@ii\relax
 \else \dimen@=#1\advance\dimen@.5\dimen@ii\fi
 \else 
 \quotient@@\tmp@#1#2\expandafter\dimen@ii\tmp@#1\relax
 \ifdim\dimen@ii>.41422#2\relax
 \dimen@=1.060665#2\advance\dimen@ .353555\dimen@ii\relax
 \else \dimen@=#2\advance\dimen@.5\dimen@ii\fi
 \fi}
\xydef@\splineDadvance@{\splineadvance@@
 \expandafter\splineDadvance@@\splineDadvance@@@}
\xydef@\splineDadvance@@#1#2#3#4{%
 {\dX=#1\advance\dX-#2\ifdim\dX<\z@ \dX=-\dX\fi 
 \dY=#3\advance\dY-#4\ifdim\dY<\z@ \dY=-\dY\fi
 \xydist@\dX\dY
 \global\advance\splinelength@\dimen@ 
}}
\xydef@\spline@end@{\lastsplinepoint@ \egroup \egroup
 \ht\z@=\z@ \dp\z@=\z@ \wdz@=\z@ \boxz@}%
\gdef\splinetest@{\splineplot@true}
\xydef@\spline@end@@{\egroup\egroup}
\xydef@\splinefrec@{{%
 \advance\splineval@\splinedepth@
\splinetrace@{F:(\the\Xp,\the\Yp);(\the\Xc,\the\Yc);;
\the\splineval@;\the\splinedepth@}%
 \ifdim\dimen5=\splineval@ \aftergroup\splinefinishf@ 
 \else \dimen@=\dimen5\advance\dimen@-\splineval@
 \ifdim\dimen@<\z@ \dimen@=-\dimen@ \fi
 \ifdim\dimen@<.0001\p@ \aftergroup\splinefinishf@
 \else
 \ifdim\dimen5<\splineval@\aftergroup\splinedecast@
 \else \aftergroup\splineadvance@ 
 \fi\fi\fi}}
\xydef@\splinefinishf@{\global\advance\splineval@\splinedepth@
 \splinefinish@}%
\xydef@\spline@find#1#2{%
 \readsplineparams@
 \global\let\splinefinish@=\splinefinish@@
 \global\let\splinegoal@=\splinef@pt 
 \global\let\splinepoint=\relax
 \dimen@=#1\relax\dimen@ii=#2\relax
 \ifdim\dimen@ii=\z@ \def\postfind@{}%
 \else\def\postfind@{}%
 \ifdim\dimen@ii<\z@ \splinereverse@ 
 \readsplineparams@ 
\splinetrace@{reverse orientation: (\the\Xp,\the\Yp),(\the\Xc,\the\Yc)}%
 \dimen@=#1\relax\dimen@ii=#2\relax
 \multiply\dimen@\m@ne \advance\dimen@\p@ \multiply\dimen@ii\m@ne
 \def\postfind@{\dX=-\the\dX \dY=-\the\dY \noexpand\reversesplineval@}%
 \fi\fi
\expandafter\splinetrace@\expandafter{\xysplineparams@}%
 \edef\next@{\noexpand\spline@@find{\the\dimen@}{\the\dimen@ii}}%
 \next@ }
\xydef@\reversesplineval@{\splineval@=-\splineval@ \advance\splineval@\p@ }
\xydef@\spline@@find#1#2{%
 \let\splinerec@=\splinefrec@ 
 \global\let\splineadvance@=\splineadvance@@
 \dimen5=#1\relax
 \ifdim #2=\z@\relax
 \ifdim #1=\z@\relax \bgroup 
 \let\splined@@=\spline@@knot
 \global\splineval@=\m@ne\p@ 
 \else\ifdim #1=\p@\relax \bgroup
 \let\splined@@=\spline@@knot 
 \global\splineval@=\z@ 
 \else
 \global\let\splineadvance@=\splineadvance@@
 \setsplinetest@\splineval@>{#1}{}%
 {{\ifdim\splineval@=\dimen5\aftergroup\splineplot@false\fi}}%
 \fi\fi
 \else 
 \def\splineslidetest@@{%
 \setsplinetest@\splinelength@<{#2}{}{}}%
 \let\splinefinish@=\splinefcontinue@
 \fi
 \let\spline@end=\splinef@end
 \let\splinepoint@=\relax
 \splinelength@=\z@ 
 \def\spline@start{\bgroup\xylowtolerance@}%
 \splined@@ }
\xydef@\spline@@knot{%
 \let\setsplinedir@=\setsplineknotdir@
 \splinesetparams@\spline@start
 \global\splinedepth@=\p@
 \global\dimen@i=\Xp \global\dimen3=\Yp 
 \splinefinishf@ \spline@end \egroup }
\xydef@\splinefcontinue@{%
\splinetrace@{sliding... from (\the\Xc,\the\Yc): val=\the\splineval@ }%
 \global\let\splinerec@=\splinerec@@
 \global\splinelength@=\z@
 \global\splineval@=\splineval@
 \global\let\splinepoint=\splinefindtest@
 \global\let\splinegoal@=\splinef@pt 
 \global\let\splineadvance@=\splineDadvance@
 \global\let\splinefinish@=\splinefinish@@ 
 \splineslidetest@@ 
 }
\xydef@\splinefindtest@{%
\splinetrace@{SFT (\the\Xc,\the\Yc); \the\splinelength@, \the\splineval@}%
 {\splineplot@false\splinetest@ 
 \ifsplineplot@\expandafter\splinefinishf@\fi}}
\xydef@\splinef@end{\edef\tmp@{\egroup\splinelength@=\the\splinelength@}\tmp@}
\xydef@\splinef@pt{%
 \ifdim\splineval@>\z@ 
\splinetrace@{found: val=\the\splineval@;c:(\the\Xc,\the\Yc)}%
 \global\dimen@i=\Xc \global\dimen3=\Yc 
 \else
\splinetrace@{found: val=\the\splineval@;p:(\the\Xp,\the\Yp)}%
 \fi
 \setsplinedir@ \global\dimen5=\dX \global\dimen7=\dY 
 \global\splineval@=\splineval@
 \aftergroup\splinefocus@ }
\def\setsplinetest@#1#2#3#4#5{%
 \DNii@{\gdef\splinetest@}%
 \DN@##1\next{\def\tmp@{{\splineplot@false \ifdim#1#2##1\relax
 #4\else\splineplot@true#5\fi}}}%
 \next@#3\relax\next
 \expandafter\nextii@\tmp@ }%
\xydef@\splinefocus@{%
 \dX=\dimen5\relax \dY=\dimen7\relax \setsplinedir@ }
\xydef@\splinesegment@#1{}
\xydef@\xyprecurve@{}
\xydef@\xypostcurve@{}
\xydef@\splineset@{%
 \ifx\bstartPLACE@\empty\splinetrace@{invisiber\count@@\endcsname 
 \edef\tmp@{\egroup \Xp=\the\Xc \Yp=\the\Yc}\tmp@ 
 \edef\segmentnum@{\xycrvptsnum@}%
 \resetDirection@ \setupDirection@ii 
 \fi \noCshavec@@ }
\xydef@\straitalong@#1{%
 \ifdim#1\p@<\z@ 
 \xywarning@{parameter value #1 is negative, using 0}%
 \cfromp@ \def\PLACEf@{{0}}%
 \else 
 \dimen@=#1\p@ \count@=\dimen@ \divide\count@\p@ 
 \expandafter\count@@\xycrvptsnum@\relax \advance\count@@\@ne
 \advance\dimen@\segmentnum@\p@ 
 \advance\count@\segmentnum@\relax 
 \def\segmentnum@{0}%
 \ifnum\count@@<\count@
 \xywarning@{parameter value #1 too large, using \the\count@@}%
 \count@=\count@@ \advance\count@\m@ne \edef\PLACEf@{{1}}%
 \else
 \advance\dimen@-\count@\p@ 
 \ifdim\dimen@=\z@\ifnum\count@>\z@
 \advance\count@\m@ne \advance\dimen@\p@ \fi\fi
 \edef\PLACEf@{{\expandafter\removePT@\the\dimen@}}%
 \fi
 \ifnum\count@=\z@\else \bgroup
 \csname cv@\number\count@\endcsname 
 \edef\tmp@{\egroup \Xp=\the\Xc \Yp=\the\Yc}\tmp@
 \fi
 \advance\count@\@ne
 \ifnum\count@<\count@@
\splinetrace@{find place \the\dimen@\space along straight segment 
 \the\count@}%
 \csname cv@\number\count@\endcsname
 \fi
 \dX=\Xc \advance\dX-\Xp \dY=\Yc \advance\dY-\Yp 
 \fi \expandafter\noCalong@@\PLACEf@ \czeroEdge@ }
\xydef@\splineconnect@{%
 \let\crvreset@=\splinereset@
 \let\crvshavep@=\splineshavep@
 \let\crvshavec@=\splineshavec@
 \let\crvslidep@=\splineslidep@
 \let\crvslidec@=\splineslidec@
 \let\crvalong@=\splinealong@
}
\xydef@\splinereset@{\the\crvpts@ 
 \edef\xycrvptsnum@{\csname ptsnum@\endcsname}%
 \edef\xysplineparams@{%
 \expandafter\noexpand\csname params@\endcsname}%
 \edef\xysplineedges@{%
 \expandafter\noexpand\csname edges@\endcsname}%
 \def\segmentnum@{0}\def\splinecorrect@p{0}\def\splinecorrect@c{0}%
 \splinelength@=\z@ \def\splineplace@f{.5}%
}
\xydef@\splineshavep@{\begingroup 
 \edef\xysplineedges@{%
 \expandafter\noexpand\csname edges@\endcsname}%
 \expandafter\expandafter\expandafter\getsplineedges@\xysplineedges@
 \edef\tmp@{\noexpand\removePT@\the\dimen5}%
 \edef\tmp@{\endgroup 
 \noexpand\def\noexpand\splinecorrect@p{\tmp@}}\tmp@ 
 \setupDirection@ii }
\xydef@\splineshavec@{\begingroup 
 \edef\xysplineedges@{%
 \expandafter\noexpand\csname edges@\endcsname}%
 \expandafter\expandafter\expandafter\getsplineedges@\xysplineedges@
 \dimen@=-\dimen7\relax 
 \expandafter\count@\xycrvptsnum@\relax
 \ifnum\count@>\@ne \advance\count@\m@ne \fi
 \advance\dimen@\count@\p@
 \edef\tmp@{\noexpand\removePT@\the\dimen@}%
 \edef\tmp@{\endgroup 
 \noexpand\def\noexpand\splinecorrect@c{\tmp@}}\tmp@ 
 \setupDirection@ii }
\xydef@\splineslidep@#1{\enter@{\pfromthep@}%
 \begingroup \splinealong@@{0}{#1}+\splineslidep@@@
 \setupDirection@ii \leave@ }%
\xydef@\splineslidep@@@{%
 \dX=\dimen5 \dY=\dimen7 \edef\tmp@{\postfind@}\tmp@ \dimen@=\splineval@
 \expandafter\count@\xycrvptsnum@\relax
 \ifnum\count@>\tw@ \advance\count@\m@ne 
 \advance\dimen@\segmentnum@\p@ \advance\dimen@-\p@ 
 \fi 
 \edef\tmp@{\endgroup \endgroup
 \noexpand\def\noexpand\xysplineval@{\the\splineval@}%
 \noexpand\def\noexpand\splinecorrect@p{\expandafter\removePT@\the\dimen@}%
\splinetrace@{slide = \the\splinelength@}%
 \Xc=\dimen@i \Yc=\dimen3
 \dX=\the\dX \dY=\the\dY
 \noexpand\def\noexpand\segmentnum@{\segmentnum@}}\tmp@ }
\xydef@\splineslidec@#1{\enter@{\pfromthep@}%
 \begingroup
 \expandafter\splinealong@@\PLACEf@{#1}+\splineslidec@@@
 \setupDirection@ii \leave@ }
\xydef@\splineslidec@@@{%
 \dX=\dimen5 \dY=\dimen7 \edef\tmp@{\postfind@}\tmp@ \dimen@=\splineval@
 \expandafter\count@\xycrvptsnum@\relax
 \ifnum\count@>\tw@ \advance\count@\m@ne 
 \advance\dimen@\segmentnum@\p@ \advance\dimen@-\p@ 
 \dimen@=-\dimen@ \advance\dimen@\count@\p@
 \else \dimen@=-\dimen@ \advance\dimen@\p@ \fi
 \edef\tmp@{\endgroup \endgroup
 \noexpand\def\noexpand\xysplineval@{\the\splineval@}%
 \noexpand\def\noexpand\splinecorrect@c{\expandafter\removePT@\the\dimen@}%
\splinetrace@{slide = \the\splinelength@}%
 \Xc=\dimen@i \Yc=\dimen3
 \dX=\the\dX \dY=\the\dY
 \noexpand\def\noexpand\segmentnum@{\segmentnum@}}\tmp@ }
\xydef@\checkslidemore@#1{%
 \dimen@ii=-#1\relax\ifdim\dimen@iobal\dimen3=\Yc 
}}
\xydef@\splinefinish@@{\postspline@ \splinegoal@ \splinecancel@ }
\xydef@\splinecancel@{%
 \global\let\splinerec@=\relax
 \global\let\splinepoint=\relax 
 \global\let\splinecontinue=\relax
 }
\xydef@\splinebreakcancel@{\bsplinecancel@ \splinecancel@}
\xydef@\bsplinecancel@{\gdef\lastbspline@{\leave@\leave@}%
 \global\let\middlebspline@=\lastbspline@ }
\xydef@\splinegoal@{\ifdim\splineval@>\z@
 \global\dimen@i=\Xc \global\dimen3=\Yc \fi
 \global\splineval@=\splineval@ \global\splinelength@=\splinelength@
 \setsplineTangent@ }
\xylet@\splinefinish@\splinefinish@@
\xylet@\splinewhich\splineDwhich@
\xydef@\squinewhich@{%
 \ifdim\dimen5>\squinelength
 \dX=\Xc \dY=\Yc \advance\dX-\Lc \advance\dY-\Uc 
 \advance\squineval-\squinedepth 
 \else \Xc=\Xp \Yc=\Yp \advance\squineval-\squinedepth
 \dX=\Lc \dY=\Uc \advance\dX-\Xp \advance\dY-\Yp \fi
 \dX=-\dX \dY=-\dY
 \squinefinish}
\xydef@\squineDwhich@{%
 \ifdim\dimen5>\squinelength
 \dX=\Xc \dY=\Yc \advance\dX-\Lc \advance\dY-\Uc 
 \else \Xc=\Xp \Yc=\Yp \advance\squineval-\squinedepth
 \dX=\Lc \dY=\Uc \advance\dX-\Xp \advance\dY-\Yp \fi
 \dX=-\dX \dY=-\dY
 \squinefinish}
\xydef@\xyquadbezier@{%
 \global\let\splinerec@=\relax
 \addtocrvpts@{\def\crvconnect@{\squineconnect@}}%
 \xyquadmethods@ \let\splinesegment@=\squinesegment@
 \begingroup\setcrvobjects@ \xysplineparams@ \splined@@@
 \bgroup \setupsquine@ \squined@ \splineset@ \savespline@ }
\xydef@\xyquadmethods@{%
 \def\crvconnect@{\squineconnect@}%
 \def\splinereverse@@{\splinereverse@@@}%
 \let\getsplineparams@=\getsquineparams@
 \let\spline@start@=\squine@start@
 \let\splinedecast@=\squinedecast@
 \let\splinerec@@=\squinerec@
 \let\splined@@=\squined@@
 \let\splineinfo@=\squineinfo@
 \let\setsplinedir@=\setsquinedir@
 \let\setsplineknotdir@=\setsquineknotdir@
 \let\splinereverse@=\squinereverse@
 \let\splineDadvance@@@=\squineDadvance@@@
 \let\splinesetparams@=\squinesetparams@
}
\xydef@\squineconnect@{\splineconnect@ \crvconnect@@ 
 \let\splinesegment@=\squinesegment@ }%
\xydef@\squinesegment@#1{\xyquadmethods@ \def\segmentnum@{\@ne}%
 \setupsquine@ \squined@ }
\xydef@\setupsquine@{%
 \xycontrolpt@\z@ \Xp=\Xc \Yp=\Yc
 \xycontrolpt@\@ne \A@=\Xc \B@=\Yc 
 \xycontrolpt@\tw@ 
 \ifdim \A@>\Xmax \advance\Xmax\A@ \divide\Xmax\tw@ \else
 \ifdim \A@<\Xmin \advance\Xmin\A@ \divide\Xmax\tw@ \fi\fi
 \ifdim \B@>\Ymax \advance\Ymax\B@ \divide\Ymax\tw@ \else
 \ifdim \B@<\Ymin \advance\Ymin\B@ \divide\Ymax\tw@ \fi\fi }
\xydef@\squinedecast@{\divide\splinedepth@\tw@ 
 \Rc=\Lc \advance\Lc\Xp \divide\Lc\tw@
 \advance\Rc\Xc \divide\Rc\tw@
 \A@=\Lc \advance\A@\Rc \divide\A@\tw@
 \Dc=\Uc \advance\Uc\Yp \divide\Uc\tw@
 \advance\Dc\Yc \divide\Dc\tw@
 \B@=\Uc \advance\B@\Dc \divide\B@\tw@
 \begingroup \Xc=\A@ \Yc=\B@ \splinerec@ \endgroup
 \begingroup \Xc=\A@ \Yc=\B@ \splinepoint \endgroup
 \Xp=\A@ \Lc=\Rc \Yp=\B@ \Uc=\Dc \splinerec@}
\xydef@\squinerec@{{\splinefar@false \splinenear@\Xp\Xc\Yp\Yc 
 \ifsplinefar@ \aftergroup\squinedecast@ 
 \else \aftergroup\splineadvance@ \fi}}
\xydef@\squineDadvance@@@{\Xp\Lc\Yp\Dc}
\xydef@\setsquinedir@{%
 \dX=\Xc \advance\dX-\Lc \dY=\Yc \advance\dY-\Uc 
 \dimen@=\ifdim\dX<\z@-\fi\dX \ifdim\dimen@<.02\p@
 \dimen@=\ifdim\dY<\z@-\fi\dY \ifdim\dimen@<.02\p@ 
 \dX=\Xc \advance\dX-\Xp \dY=\Yc \advance\dY-\Yp \fi\fi
 \ifdim\Xc=\Xp \ifdim\Yc=\Yp 
 \dX=\Lc \advance\dX-\Xp \dY=\Uc \advance\dY-\Yp \fi\fi
 \setupDirection@ii } 
\xydef@\setsquineknotdir@{%
 \ifdim\splineval@=\z@ \expandafter \setsquinezerodir@
 \else\expandafter \setsquinedir@ \fi } 
\xydef@\setsquinezerodir@{%
 \dX=\Lc \advance\dX-\Xp \dY=\Uc \advance\dY-\Yp 
 \ifdim\dX=\z@ \relax \ifdim\dY=\z@ 
 \dX=\Xc \advance\dX-\Xp \dY=\Yc \advance\dY-\Yp 
 \fi\fi \setupDirection@ii }
\xydef@\getsquineparams@#1,#2,#3,#4,#5,#6,#7,{%
 \splinelength@=#1\relax\Xp=#2\relax\Yp=#3\relax
 \A@=#4\relax\B@=#5\relax\Xc=#6\relax\Yc=#7\relax
}
\xydef@\squineinfo@{%
\expandafter\removePT@\the\Xc\space
\expandafter\removePT@\the\Yc\space
\expandafter\removePT@\the\A@\space
\expandafter\removePT@\the\B@\space
\expandafter\removePT@\the\Xp\space
\expandafter\removePT@\the\Yp\space
\expandafter\removePT@\the\dimen5\space\space
\expandafter\removePT@\the\dimen7\space
 }%
\xydef@\squinereverse@{\readsplineparams@
 \expandafter\edef\xysplineparams@{\the\splinelength@,%
 \the\Xc,\the\Yc,\the\A@,\the\B@,\the\Xp,\the\Yp,}}%
\xydef@\squine@start@{\setboxz@h\bgroup
 \global\splinelength@=\z@ \global\dimen@i=\z@ \global\dimen3=\z@
 \kern\Xp
 {\squinesetparams@ \Xc=\Xp \Yc=\Yp \firstsplinepoint@
 }\bgroup }
\xydef@\squinesetparams@{%
 \global\dimen@i=\Xp \global\dimen3=\Yp 
 \Lc=\A@ \Uc=\B@ \Rc=\Lc \Dc=\Uc }%
\xydef@\squined@{%
 \expandafter\edef\xysplineparams@{%
 \the\z@,\the\Xp,\the\Yp,\the\A@,\the\B@,\the\Xc,\the\Yc,}}
\xydef@\squined@@{%
 \global\splinedepth@=\p@ 
 \global\splineval@=\z@ 
 \global\dimen@i=\Xp \global\dimen3=\Yp
 \spline@start
 \ifx\splinerec@\relax \let\splinerec@=\squinerec@\fi
 \Lc=\A@ \Uc=\B@ \Rc=\Lc \Dc=\Uc 
 \splinerec@ \spline@end }
\xydef@\xycubicbezier@{%
 \addtocrvpts@{\def\crvconnect@{\cubicconnect@}}%
 \xycubicmethods@ \let\splinesegment@=\cubicsegment@
 \begingroup \setcrvobjects@ \xysplineparams@ \splined@@@ 
 \bgroup \setupcubic@ \cubiced@ \splineset@ \savespline@ }
\xydef@\xycubicmethods@{%
 \def\crvconnect@{\cubicconnect@}%
 \def\splinereverse@@{\cubicreverse@@}%
 \let\getsplineparams@=\getcubicparams@
 \let\spline@start@=\cubic@start@
 \let\splinedecast@=\cubicdecast@
 \let\splinerec@@=\cubicrec@
 \let\splined@@=\cubiced@@
 \let\splineinfo@=\cubicinfo@
 \let\setsplinedir@=\setcubicdir@
 \let\setsplineknotdir@=\setcubicknotdir@
 \let\splinereverse@=\cubicreverse@ 
 \let\splineDadvance@@@=\cubicDadvance@@@
 \let\splinesetparams@=\cubicsetparams@
 }
\xydef@\cubicconnect@{\splineconnect@ \crvconnect@@
 \let\splinesegment@=\cubicsegment@ }%
\xydef@\cubicsegment@#1{\xycubicmethods@ \def\segmentnum@{\@ne}%
 \setupcubic@ \cubiced@ }
\xydef@\setupcubic@{%
 \xycontrolpt@\z@ \Xp=\Xc \Yp=\Yc
 \xycontrolpt@\@ne \A@=\Xc \B@=\Yc 
 \xycontrolpt@\tw@ \global\dimen3=\Xc \global\dimen5=\Yc
 \xycontrolpt@\thr@@ 
 \adjustmaxmin@ }
\xydef@\adjustmaxmin@{%
 \ifdim \A@>\Xmax \dimen@=\A@ \advance\dimen@\Xp \divide\dimen@\tw@ 
 \ifdim\dimen@>\Xmax \Xmax=\dimen@ \fi \else
 \ifdim \A@<\Xmin \dimen@=\A@ \advance\dimen@\Xp \divide\dimen@\tw@ 
 \ifdim\dimen@<\Xmin \Xmin=\dimen@ \fi \fi\fi
 \ifdim \B@>\Ymax \dimen@=\B@ \advance\dimen@\Yp \divide\dimen@\tw@ 
 \ifdim\dimen@>\Ymax \Ymax=\dimen@ \fi \else
 \ifdim \B@<\Ymin \dimen@=\B@ \advance\dimen@\Yp \divide\dimen@\tw@ 
 \ifdim\dimen@<\Ymin \Ymin=\dimen@ \fi \fi\fi
 \ifdim \dimen3>\Xmax \dimen@=\dimen3\advance\dimen@\Xc \divide\dimen@\tw@ 
 \ifdim\dimen@>\Xmax \Xmax=\dimen@ \fi \else
 \ifdim \dimen3<\Xmin \dimen@=\dimen3\advance\dimen@\Xc \divide\dimen@\tw@ 
 \ifdim\dimen@<\Xmin \Xmin=\dimen@ \fi \fi\fi
 \ifdim \dimen5>\Ymax \dimen@=\dimen5\advance\dimen@\Yc \divide\dimen@\tw@ 
 \ifdim\dimen@>\Ymax \Ymax=\dimen@ \fi \else
 \ifdim \dimen5<\Ymin \dimen@=\dimen5\advance\dimen@\Yc \divide\dimen@\tw@ 
 \ifdim\dimen@<\Ymin \Ymin=\dimen@ \fi \fi\fi
 \dimen@=\A@ \advance\dimen@\dimen3\divide\dimen@\tw@
 \ifdim\dimen@>\Xmax \Xmax=\dimen@
 \else \ifdim\dimen@<\Xmin \Xmin=\dimen@ \fi\fi
 \dimen@=\B@ \advance\dimen@\dimen5\divide\dimen@\tw@
 \ifdim\dimen@>\Ymax \Ymax=\dimen@
 \else \ifdim\dimen@<\Ymin \Ymin=\dimen@ \fi\fi
}
\xydef@\cubicdecast@{\divide\splinedepth@\tw@
\A@=\Lc \advance\A@\Rc \divide\A@\tw@
\advance\Rc\Xc \divide\Rc\tw@
\B@=\Uc \advance\B@\Dc \divide\B@\tw@
\advance\Dc\Yc \divide\Dc\tw@
\advance\Lc\Xp \divide\Lc\tw@
\advance\Uc\Yp \divide\Uc\tw@
\begingroup 
\Xc=\Rc \advance\Xc\Lc \divide\Xc\tw@ 
 \advance\Xc\A@ \divide\Xc\tw@
\Yc=\Dc \advance\Yc\Uc \divide\Yc\tw@ 
 \advance\Yc\B@ \divide\Yc\tw@
\Rc=\Lc \advance\Rc\A@ \divide\Rc\tw@
\Dc=\Uc \advance\Dc\B@ \divide\Dc\tw@
\bgroup \splinerec@ \egroup 
\splinepoint \endgroup
\Xp=\Lc \advance\Xp\Rc \divide\Xp\tw@
 \advance\Xp\A@ \divide\Xp\tw@
\Lc=\Rc \advance\Lc\A@ \divide\Lc\tw@
\Yp=\Uc \advance\Yp\Dc \divide\Yp\tw@
 \advance\Yp\B@ \divide\Yp\tw@
\Uc=\Dc \advance\Uc\B@ \divide\Uc\tw@
\splinerec@ }
\xydef@\cubicrec@{{\splinefar@false \splinenear@\Xp\Xc\Yp\Yc 
 \ifsplinefar@ \aftergroup\cubicdecast@
 \else \aftergroup\splineadvance@ \fi}}
\xydef@\cubicDadvance@@@{\Xp\Xc\Yp\Yc}
\xydef@\cubiced@@{%
 \global\splinedepth@=\p@ 
 \global\splineval@=\z@ 
 \spline@start 
 \global\dimen@i=\Xp \global\dimen3=\Yp
 \splinerec@ \spline@end }
\xydef@\setcubicdir@{%
 \ifdim\splinedepth@<.001\p@\DN@{\cubiccoarsedir@}%
 \else\DN@{\cubicfinedir@}\fi \next@ }
\xydef@\cubicfinedir@{%
 \dX=\Xc \advance\dX-\Rc \dY=\Yc \advance\dY-\Dc 
 \ifdim\dX=\z@ \ifdim\dY=\z@ 
 \dX=\Xc \advance\dX-\Lc \dY=\Yc \advance\dY-\Uc 
 \ifdim\dX=\z@ \ifdim\dY=\z@ 
 \dX=\Xc \advance\dX-\Xp \dY=\Yc \advance\dY-\Yp 
 \fi\fi \fi\fi
 \ifdim\Xc=\Xp \ifdim\Yc=\Yp 
 \dX=\Lc \dY=\Uc \advance\dX-\Xp \advance\dY-\Yp 
 \ifdim\dX=\z@ \ifdim\dY=\z@ 
 \dX=\Rc \dY=\Dc \advance\dX-\Xp \advance\dY-\Yp \fi\fi
 \fi\fi \setupDirection@ii 
\splinetrace@{dir:(\the\dX,\the\dY),\the\Direction; depth:\the\splinedepth@}} 
\xydef@\cubiccoarsedir@{%
 \dX=\Xc \advance\dX-\Xp \dY=\Yc \advance\dY-\Yp \setupDirection@ii
 \global\dimen5=\dX \global\dimen7=\dY
\splinetrace@{dir:(\the\dX,\the\dY),\the\Direction; depth:\the\splinedepth@}} 
\xydef@\setcubicknotdir@{%
 \ifdim\splineval@=\z@ \expandafter \setcubiczerodir@
 \else\expandafter \setcubicdir@ \fi } 
\xydef@\setcubiczerodir@{%
 \dX=\Lc \advance\dX-\Xp \dY=\Uc \advance\dY-\Yp 
 \ifdim\dX=\z@ \relax \ifdim\dY=\z@ 
 \dX=\Rc \advance\dX-\Xp \dY=\Dc \advance\dY-\Yp 
 \ifdim\dX=\z@ \relax \ifdim\dY=\z@ 
 \dX=\Xc \advance\dX-\Xp \dY=\Yc \advance\dY-\Yp 
 \fi\fi \fi\fi \setupDirection@ii }
\xydef@\getcubicparams@#1,#2,#3,#4,#5,#6,#7,#8,#9,{%
 \splinelength@=#1\relax\Xp=#2\relax\Yp=#3\relax\Lc=#4\relax
 \Uc=#5\relax\Rc=#6\relax\Dc=#7\relax\Xc=#8\relax\Yc=#9\relax
}%
\xydef@\cubicinfo@{%
\expandafter\removePT@\the\Xp\space
\expandafter\removePT@\the\Yp\space
\expandafter\removePT@\the\Lc\space
\expandafter\removePT@\the\Uc\space
\expandafter\removePT@\the\Rc\space
\expandafter\removePT@\the\Dc\space
\expandafter\removePT@\the\Xc\space
\expandafter\removePT@\the\Yc\space
\expandafter\removePT@\the\dimen5\space\space
\expandafter\removePT@\the\dimen7\space
 }%
\xydef@\cubicreverse@{\readsplineparams@
 \expandafter\edef\xysplineparams@{\the\splinelength@,%
 \the\Xc,\the\Yc,\the\Rc,\the\Dc,\the\Lc,\the\Uc,\the\Xp,\the\Yp,}}%
\xydef@\cubicreverse@@{%
 \splinereverse@@@ 
 \dimen@ii=\Lc \Lc=\Rc \Rc=\dimen@ii 
 \dimen@ii=\Uc \Uc=\Dc \Dc=\dimen@ii }
\xydef@\cubic@start@{\setboxz@h\bgroup
 \global\splinelength@=\z@ \global\dimen@i=\z@ \global\dimen3=\z@
 \kern\Xp
 {\cubicsetparams@ \Xc=\Xp \Yc=\Yp \Rc=\Xc \Dc=\Yc \firstsplinepoint@ }\bgroup 
}
\xydef@\cubicsetparams@{%
 \expandafter\expandafter\expandafter\getsplineparams@\xysplineparams@
 \global\dimen@i=\Xp \global\dimen3=\Yp }
\xydef@\cubiced@{%
 \expandafter\edef\xysplineparams@{\the\z@,\the\Xp,\the\Yp
 ,\the\A@,\the\B@,\the\dimen3,\the\dimen5,\the\Xc,\the\Yc,}%
 }%
\xydef@\xybspline@iii{%
 \addtocrvpts@{\def\crvconnect@{\bsplineiiiconnect@}}%
 \def\crvconnect@{\bsplineiiiconnect@}\xybsplinemethods@ 
 \let\splinesegment@=\bsplinesegment@iii
 \begingroup\setcrvobjects@ \dobspline@ \savespline@ }
\xydef@\bsplineiiiconnect@{\splineconnect@ \crvconnect@@
 \let\splinesegment@=\bsplinesegment@iii }%
\xydef@\xybspline@iv{%
 \addtocrvpts@{\def\crvconnect@{\bsplineivconnect@}}%
 \def\crvconnect@{\bsplineivconnect@}\xybsplinemethods@
 \let\splinesegment@=\bsplinesegment@iv
 \begingroup\setcrvobjects@ \dobspline@ \savespline@ }
\xydef@\bsplineivconnect@{\splineconnect@ \crvconnect@@
 \let\splinesegment@=\bsplinesegment@iv }%
\xydef@\xybspline@{%
\splinetrace@{B-spline with \numcontrolpts\space control points.}%
 \addtocrvpts@{\def\crvconnect@{\bsplineconnect@}}%
 \def\crvconnect@{\bsplineconnect@}\xybsplinemethods@ 
 \let\splinesegment@=\bsplinesegment@ 
 \begingroup\setcrvobjects@
 \dobspline@ \savespline@ }
\xydef@\xybsplinemethods@{%
 \def\splinereverse@@{\cubicreverse@@}%
 \let\getsplineparams@=\getbsplineparams@
 \let\spline@start@=\cubic@start@
 \let\splinedecast@=\cubicdecast@
 \let\splinerec@@=\cubicrec@
 \let\splined@@=\bsplined@@
 \let\splineinfo@=\cubicinfo@
 \let\setsplinedir@=\setcubicdir@
 \let\setsplineknotdir@=\setcubicknotdir@
 \let\splinereverse@=\cubicreverse@ 
 \let\splineDadvance@@@=\cubicDadvance@@@
 \let\splinesetparams@=\cubicsetparams@
 \global\let\lastbspline@=\lastbspline@@
 \global\let\middlebspline@=\middlebspline@@
}
\xydef@\bsplined@@{%
 \global\splinedepth@=\p@ 
 \global\splineval@=\z@ 
 \spline@start 
 \global\dimen@i=\Xp \global\dimen3=\Yp
 \splinerec@ \spline@end }
\xydef@\bsplineconnect@{\splineconnect@ \crvconnect@@
 \let\splinesegment@=\bsplinesegment@ }%
\xydef@\getbsplineparams@{\getcubicparams@}
\xydef@\dobspline@{\xysplineparams@ \scanbspline@ \firstbspline@ }%
\xydef@\firstbspline@{%
 \enter@{\pfromthep@ \cfromthec@}\enter@{\cfromthec@}\bgroup
 \def\segmentnum@{1}\xycontrolpt@\z@ \Xp=\Xc \Yp=\Yc
\splinetrace@{0: \the\Xp, \the\Yp}%
 \xycontrolpt@\@ne \A@=\Xc \B@=\Yc 
\splinetrace@{1: \the\Xc, \the\Yc}%
 \xycontrolpt@\tw@ 
\splinetrace@{2: \the\Xc, \the\Yc}%
 \dimen@=\Xc \advance\dimen@\A@ \divide\dimen@\tw@
 \global\dimen3=\dimen@
 \dimen@=\Yc \advance\dimen@\B@ \divide\dimen@\tw@
 \global\dimen5=\dimen@
 \xycontrolpt@{3}%
\splinetrace@{3: \the\Xc, \the\Yc}%
 \expandafter\count@\xycrvcnt@\relax
 \ifnum\count@=3\relax 
 \advance\Xc-\A@ \divide\Xc by4\advance\Xc\dimen3\relax
 \advance\Yc-\B@ \divide\Yc by4\advance\Yc\dimen5\relax
 \enter@{\Xp=\the\Xc \Yp=\the\Yc \crv@cnt@=\@ne\relax
 \noexpand\lastbspline@ }%
 \else 
 \advance\Xc 7\dimen3\advance\Xc-2\A@ \divide\Xc by6\relax
 \advance\Yc 7\dimen5\advance\Yc-2\B@ \divide\Yc by6\relax
 \enter@{\Xp=\the\Xc \Yp=\the\Yc \crv@cnt@=\@ne\relax
 \noexpand\middlebspline@ }%
 \fi \adjustmaxmin@ \czeroEdge@
 \bsplined@ \splineset@ \leave@ }
\xydef@\lastbspline@@{\bgroup 
 \advance\crv@cnt@\@ne \edef\segmentnum@{\the\crv@cnt@}%
\splinetrace@{<: \the\Xp, \the\Yp}%
 \advance\crv@cnt@\@ne \xycontrolpt@{\crv@cnt@}%
 \global\dimen3=\Xc \global\dimen5=\Yc
\splinetrace@{\the\crv@cnt@: \the\Xc, \the\Yc}%
 \advance\crv@cnt@\m@ne \xycontrolpt@{\crv@cnt@}%
\splinetrace@{\the\crv@cnt@: \the\Xc, \the\Yc}%
 \A@=\Xc \advance\A@\dimen3\divide\A@\tw@
 \B@=\Yc \advance\B@\dimen5\divide\B@\tw@
 \adjustmaxmin@ \leave@
\splinetrace@{>: \the\Xc, \the\Yc}%
 \bsplined@ \splineset@ \leave@ }%
\xylet@\lastbspline@=\lastbspline@@
\xydef@\middlebspline@@{%
 \advance\crv@cnt@\@ne \edef\segmentnum@{\the\crv@cnt@}%
\splinetrace@{<: \the\Xp, \the\Yp}%
 \bgroup 
 \xycontrolpt@{\crv@cnt@}\A@=2\Xc \B@=2\Yc
\splinetrace@{\the\crv@cnt@: \the\Xc, \the\Yc}%
 \advance\crv@cnt@\@ne \xycontrolpt@{\crv@cnt@}%
\splinetrace@{\the\crv@cnt@: \the\Xc \the\Yc}%
 \advance\A@\Xc \divide\A@ by3\advance\B@\Yc \divide\B@ by3\relax
 \advance\Xc\A@ \divide\Xc\tw@ \advance\Yc\B@ \divide\Yc\tw@
 \global\dimen3=\Xc \global\dimen5=\Yc 
 \advance\crv@cnt@\@ne \xycontrolpt@{\crv@cnt@}%
\splinetrace@{\the\crv@cnt@: \the\Xc \the\Yc}%
 \expandafter\count@\xycrvcnt@\relax 
 \ifnum\crv@cnt@<\count@\relax 
 \advance\Xc 7\dimen3\advance\Xc-2\A@ \divide\Xc by6\relax
 \advance\Yc 7\dimen5\advance\Yc-2\B@ \divide\Yc by6\relax
 \enter@{\Xp=\the\Xc \Yp=\the\Yc \crv@cnt@=\segmentnum@\relax
 \noexpand\middlebspline@}%
 \else 
 \advance\Xc-\A@ \divide\Xc by4\advance\Xc \dimen3\relax
 \advance\Yc-\B@ \divide\Yc by4\advance\Yc \dimen5\relax
 \enter@{\Xp=\the\Xc \Yp=\the\Yc \noexpand\lastbspline@}%
 \fi \adjustmaxmin@ 
 \bsplined@ \splineset@ \leave@ } 
\xylet@\middlebspline@=\middlebspline@@
\xydef@\scanbspline@{\splined@@@}
\xydef@\bsplined@{\cubiced@ 
 \expandafter\ifx\xysplineedges@\relax\relax\else
 \readsplineparams@ 
 \count@@=\dimen7\divide\count@@\p@ 
 \advance\dimen7-\count@@\p@ \advance\count@@\@ne 
 \count@=\dimen5\divide\count@\p@ 
 \advance\dimen5-\count@\p@ \advance\count@\@ne
\splinetrace@{segment \segmentnum@:\the\count@,\the\count@@:\xysplineedges@}%
\splinetrace@{params:\xysplineparams@}%
 \expandafter\ifnum\segmentnum@=\count@
 \else
 \expandafter\ifnum\segmentnum@<\count@\dimen5=\p@
 \else\dimen5=\z@ \fi\fi
 \expandafter\ifnum\segmentnum@=\count@@
 \multiply\dimen7by\m@ne \advance\dimen7by\p@
 \else
 \expandafter\ifnum\segmentnum@>\count@@\dimen5=\p@\dimen7=\p@
 \else\dimen7=\z@ \fi\fi
 \expandafter\edef\xysplineedges@{%
 \noexpand\z@;\the\dimen5,\noexpand\z@;\the\dimen7,}%
 \edef\tmp@{%
 \noexpand\def\expandafter\noexpand\xysplineedges@{\xysplineedges@}}%
 \tmp@ 
 \fi }%
\xydef@\bsegment@@ii@iii{%
 \xycontrolpt@{\count@@}\global\dimen3=\Xc \global\dimen5=\Yc
\splinetrace@{\the\count@@: \the\Xc \the\Yc}%
 \advance\count@@\@ne \xycontrolpt@{\count@@}\A@=\Xc \B@=\Yc
 \advance\A@ by2\dimen3\divide\A@ by3\relax
 \advance\B@ by2\dimen5\divide\B@ by3\relax
 \dimen@=\dimen3 \advance\dimen@ by2\Xc \divide\dimen@\thr@@
 \global\dimen3=\dimen@
 \dimen@=\dimen5 \advance\dimen@ by2\Yc \divide\dimen@\thr@@ 
 \global\dimen5=\dimen@
 \advance\count@@\m@ne }
\xydef@\bsegment@@i{\bgroup
 \advance\count@@\m@ne \xycontrolpt@{\count@@}%
\splinetrace@{\the\count@@: \the\Xc \the\Yc}%
 \edef\tmp@{\egroup \Xp=\the\Xc \Yp=\the\Yc}\tmp@
 \advance\Xp-2\dimen3\advance\Xp by7\A@ \divide\Xp by6\relax
 \advance\Yp-2\dimen5\advance\Yp by7\B@ \divide\Yp by6\relax 
}
\xydef@\bsegment@@iv{%
 \advance\count@@\tw@ \xycontrolpt@{\count@@}%
\splinetrace@{\the\count@@: \the\Xc \the\Yc}%
 \advance\Xc by7\dimen3\advance\Xc-2\A@ \divide\Xc by6\relax
 \advance\Yc by7\dimen5\advance\Yc-2\B@ \divide\Yc by6\relax 
}
\xydef@\bsegment@@ii@i{\bgroup
 \advance\count@@\m@ne \xycontrolpt@{\count@@}%
\splinetrace@{\the\count@@: \the\Xc \the\Yc}%
 \edef\tmp@{\egroup \Xp=\the\Xc \Yp=\the\Yc}\tmp@
 \advance\Xp-\dimen3\advance\Xp by4\A@ \divide\Xp by4\relax
 \advance\Yp-\dimen5\advance\Yp by4\B@ \divide\Yp by4\relax
}
\xydef@\bsegment@@y@iv{%
 \advance\count@@\tw@ \xycontrolpt@{\count@@}%
\splinetrace@{\the\count@@: \the\Xc \the\Yc}%
 \advance\Xc by4\dimen3\advance\Xc-\A@ \divide\Xc by4\relax
 \advance\Yc by4\dimen5\advance\Yc-\B@ \divide\Yc by4\relax
}
\xydef@\bsegment@i{%
 \xycontrolpt@\z@ \Xp=\the\Xc \Yp=\the\Yc
\splinetrace@{0: \the\Xp \the\Yp}%
 \xycontrolpt@\@ne
\splinetrace@{1: \the\Xc \the\Yc}\A@=\Xc \B@=\Yc 
 \xycontrolpt@\tw@
 \dimen@=\Xc \advance\dimen@\A@ \divide\dimen@\tw@
 \global\dimen3=\dimen@
\splinetrace@{2: \the\Xc \the\Yc}%
 \dimen@=\Yc \advance\dimen@\B@ \divide\dimen@\tw@
 \global\dimen5=\dimen@ }
\xydef@\bsegment@i@iv{%
 \xycontrolpt@{3}%
\splinetrace@{3: \the\Xc \the\Yc}%
 \advance\Xc by7\dimen3\advance\Xc-2\A@ \divide\Xc by6\relax
 \advance\Yc by7\dimen5\advance\Yc-2\B@ \divide\Yc by6\relax
 }
\xydef@\bsegment@z{%
 \expandafter\count@@\xycrvptsnum@ \advance\count@@\@ne 
 \xycontrolpt@{\the\count@@}\relax\edef\tmp@{\Xc=\the\Xc \Yc=\the\Yc}%
\splinetrace@{\the\count@@: \the\Xc, \the\Yc}%
 \advance\count@@\m@ne \xycontrolpt@{\the\count@@}%
\splinetrace@{\the\count@@: \the\Xc, \the\Yc}%
 \global\dimen3=\Xc \global\dimen5=\Yc
 \advance\count@@\m@ne \xycontrolpt@{\the\count@@}%
\splinetrace@{\the\count@@: \the\Xc, \the\Yc}%
 \A@=\Xc \advance\A@\dimen3\divide\A@\tw@
 \B@=\Yc \advance\B@\dimen5\divide\B@\tw@ \tmp@
 }
\xydef@\bsegment@z@i{%
 \expandafter\count@@\xycrvptsnum@\relax\advance\count@@-\tw@ 
 \edef\tmp@{\Xc=\the\Xc \Yc=\the\Yc}%
 \xycontrolpt@{\count@@}\Xp=\the\Xc \Yp=\the\Yc
\splinetrace@{\the\count@@: \the\Xc, \the\Yc}%
 \advance\Xp by7\A@ \advance\Xp-2\dimen3\divide\Xp by6\relax
 \advance\Yp by7\B@ \advance\Yp-2\dimen5\divide\Yp by6\relax 
 \tmp@ }
\xydef@\bsplinesegment@#1{\xybsplinemethods@ 
 \count@@=#1\relax 
 \ifnum\count@@=\@ne
 \bsegment@i \bsegment@i@iv
 \else\ifnum\count@@=\tw@
 \bsegment@@ii@iii \bsegment@@ii@i \bsegment@@iv
 \else\expandafter\count@\xycrvptsnum@\advance\count@\m@ne
 \ifnum\count@@=\count@
 \bsegment@z \bsegment@z@i 
 \else\advance\count@\m@ne
 \ifnum\count@@=\count@
 \bsegment@@ii@iii \bsegment@@i \bsegment@@y@iv
 \else
 \bsegment@@ii@iii \bsegment@@i \bsegment@@iv
 \fi\fi\fi\fi 
 \def\segmentnum@{\number#1}\bsplined@ }
\xydef@\bsplinesegment@iii#1{\xybsplinemethods@ 
\splinetrace@{2 segments; \number#1}%
 \count@@=#1\relax 
 \ifnum\count@@=\@ne \bsegment@i 
 \xycontrolpt@{3}%
\splinetrace@{3: \the\Xc, \the\Yc}%
 \advance\Xc 4\dimen3\advance\Xc-\A@ \divide\Xc by4\relax
 \advance\Yc 4\dimen5\advance\Yc-\B@ \divide\Yc by4\relax
 \else\ifnum\count@@=\tw@ \bsegment@z 
 \bgroup\xycontrolpt@{\@ne}%
\splinetrace@{1: \the\Xc, \the\Yc}%
 \edef\tmp@{\egroup \Xp=\the\Xc \Yp=\the\Yc}\tmp@
 \advance\Xp 4\A@ \advance\Xp-\dimen3\divide\Xp by4\relax
 \advance\Yp 4\B@ \advance\Yp-\dimen5\divide\Yp by4\relax
 \fi\fi \def\segmentnum@{\number#1}\bsplined@
}
\xydef@\bsplinesegment@iv#1{\xybsplinemethods@ 
\splinetrace@{3 segments; \number#1}%
 \count@@=#1\relax 
 \ifnum\count@@=\@ne \bsegment@i \bsegment@i@iv
 \else\ifnum\count@@=\tw@
 \bsegment@@ii@iii \bsegment@@ii@i \bsegment@@y@iv
 \else\ifnum\count@@=3\relax
 \bsegment@z \bsegment@z@i
 \fi\fi\fi \def\segmentnum@{\number#1}\bsplined@
 }
\xyendinput
